<template>
  <div class="mainWrapper abnormal taskAssignments">
    <el-breadcrumb separator="/">
      <el-breadcrumb-item :to="{ path: '/' }"
        ><i class="lh lh-diaodu fw_100"></i
      ></el-breadcrumb-item>
      <el-breadcrumb-item>调度中心</el-breadcrumb-item>
      <el-breadcrumb-item>任务派工</el-breadcrumb-item>
    </el-breadcrumb>

    <div class="content_Box box-shadow">
      <div class="pt_5 px_15">
        <el-form
          :inline="true"
          :model="ruleForm"
          class="form-inline"
          @keyup.enter.native="shearchBtn()"
        >
          <el-form-item
            ><el-input
              size="mini"
              class="w_140"
              v-model="task_sn"
              placeholder="任务编号"
            ></el-input
          ></el-form-item>
          <el-form-item
            ><el-input
              size="mini"
              class="w_120"
              v-model="demand_sn"
              placeholder="订单编号"
            ></el-input
          ></el-form-item>
          <el-form-item
            ><el-input
              size="mini"
              class="w_80"
              v-model="staff_name"
              placeholder="接单人"
            ></el-input
          ></el-form-item>
          <el-form-item
            ><el-input
              size="mini"
              class="w_110"
              v-model="mobile"
              placeholder="手机号"
            ></el-input
          ></el-form-item>

          <el-form-item>
            <el-autocomplete
              size="mini"
              class="w_130"
              v-model="shop_name"
              :fetch-suggestions="querySearch"
              placeholder="店铺名称"
              :trigger-on-focus="true"
              @select="handleSelect"
            ></el-autocomplete>
          </el-form-item>
          <lh-agent-list
            @sendValue="setValue"
            :reset="agent_reset"
          ></lh-agent-list>
          <el-form-item>
            <el-select
              class="w_110"
              v-model="city_val"
              placeholder="请选择城市"
              @change="changeCity"
            >
              <el-option
                v-for="item in cityList"
                :key="item.id"
                :label="item.name"
                :value="`${item.id}|${item.name}|${item.city_sn}`"
              ></el-option>
            </el-select>
          </el-form-item>

          <el-form-item>
            <el-select
              v-model="s_time_slot"
              multiple
              collapse-tags
              placeholder="商圈"
              @change="changeBtndialogarea()"
            >
              <el-button
                size="mini"
                type="primary"
                class="round-right all-area"
                @click="selectAllArea()"
                native-type="button"
                >{{ areaStatus ? '全选' : '取消全选' }}</el-button
              >
              <el-option
                v-for="item in areaList"
                :key="item.id"
                :label="item.area_name"
                :value="`${item.id}|${item.area_name}`"
              ></el-option>
            </el-select>
          </el-form-item>
          <el-form-item>
            <el-select
              class="w_110"
              v-model="job_level"
              placeholder="用工等级"
              clearable
            >
              <el-option
                v-for="item in levelList"
                :key="item.id"
                :label="item.name"
                :value="item.id"
              ></el-option>
            </el-select>
          </el-form-item>
          <el-form-item prop="date1">
            <el-date-picker
              size="mini"
              type="datetime"
              class="w_120i"
              value-format="yyyy-MM-dd HH:mm:ss"
              format="MM-dd HH:mm"
              placeholder="开始时间"
              v-model="ruleForm.date1"
            ></el-date-picker> </el-form-item
          >~
          <el-form-item prop="date2">
            <el-date-picker
              size="mini"
              type="datetime"
              class="w_120i"
              value-format="yyyy-MM-dd HH:mm:ss"
              format="MM-dd HH:mm"
              placeholder="结束时间"
              v-model="ruleForm.date2"
            ></el-date-picker>
          </el-form-item>

          <el-button
            size="mini"
            type="primary"
            class="round-right"
            @click="shearchBtn()"
            native-type="button"
            >搜索</el-button
          >
          <el-button size="mini" round @click="resetBtn">重置</el-button>
        </el-form>
      </div>
      <div class="pb_5 px_15 mb_5" id="dd-row-2">
        <el-row>
          <el-col :span="14">
            <el-button
              size="mini"
              class="fl"
              :type="status == 100 ? 'danger' : 'default'"
              @click="tagstate(100)"
              >超时未确认({{ statistic.abnormal }})</el-button
            >
            <el-button
              size="mini"
              class="fl"
              :type="status == 10 ? 'warning' : 'default'"
              @click="tagstate(10)"
              >待分配({{
                (statistic.assigning *= 1) + (statistic.withdraw *= 1)
              }})</el-button
            >
            <el-button
              size="mini"
              class="fl"
              :type="status == 15 ? 'warning' : 'default'"
              @click="tagstate(15)"
              >待下发({{ statistic.issued }})</el-button
            >
            <el-button
              size="mini"
              class="fl"
              :type="status == 20 ? 'warning' : 'default'"
              @click="tagstate(20)"
              >待确认({{ statistic.assigned }})</el-button
            >
            <el-button
              size="mini"
              class="fl"
              :type="status == 300 ? 'success' : 'default'"
              @click="tagstate(300)"
              >全部({{ statistic.all }})</el-button
            >
            <el-button
              size="mini"
              class="fl distribution_btn"
              v-if="status == 15"
              type="default"
              @click="distributionAll()"
              :disabled="statistic.issued == 0 ? true : false"
              >一键下发</el-button
            >
          </el-col>

          <el-col :span="10">
            <!-- 简洁分页组件 -->
            <pagemini
              :total="total"
              class="fr"
              :pageNums="pageNum"
              @pagedata="onChildValue"
            ></pagemini>
          </el-col>
        </el-row>
      </div>

      <div class="tableMaxBox">
        <template>
          <el-table
            :data="demandList"
            stripe
            ref="multipleTable"
            @selection-change="handleSelectionChange"
            :show-overflow-tooltip="false"
            height="360"
            class="set-border-radius"
          >
            <el-table-column
              type="selection"
              v-if="status == 10 || status == 15"
              align="center"
              width="50"
            ></el-table-column>
            <el-table-column prop="task_sn" label="任务编号" width="130px">
              <template slot-scope="{ row }">
                <span class="pointer u text-primary" @click="goToMore(row)">{{
                  row.task_sn
                }}</span>
              </template>
            </el-table-column>
            <el-table-column prop="total" label="接单人" width="140">
              <template slot-scope="{ row }">
                <span
                  :class="[
                    row.is_bind == 1 ? 'text-danger' : 'text-success',
                    'pointer',
                  ]"
                  @click="toPersonnelListHx(row)"
                  >{{ row.staff_name }} {{ row.mobile }}</span
                >
              </template>
            </el-table-column>
            <el-table-column prop="shop_name" label="店铺名称" width="170">
              <template slot-scope="{ row }">
                <el-tooltip
                  effect="dark"
                  placement="top"
                  v-if="row.shop_remark != '' || row.shop_contact != ''"
                >
                  <div slot="content">
                    <span class=""
                      >店铺负责人：{{ row.shop_contact }}&nbsp;&nbsp;{{
                        row.shop_contact_phone
                      }}</span
                    >
                    <span class="tooltip">{{ row.shop_remark }}</span>
                    <span>{{ row.address }} - </span>
                    <span>{{ row.detailed_address }}</span>
                  </div>
                  <div>
                    <span
                      v-if="row.shop_is_halal == 1"
                      style="
                        background: #c93a32;
                        color: #fff;
                        padding: 2px 3px;
                        border-radius: 3px;
                      "
                      >清真</span
                    >
                    <span
                      class="pointer u text-primary"
                      @click="shopLists(row)"
                      >{{ row.shop_name }}</span
                    >
                  </div>
                </el-tooltip>
                <div v-if="row.shop_remark == '' && row.shop_contact == ''">
                  <div>
                    <span
                      v-if="row.shop_is_halal == 1"
                      style="
                        background: #c93a32;
                        color: #fff;
                        padding: 2px 3px;
                        border-radius: 3px;
                      "
                      >清真</span
                    >
                    <span
                      class="pointer u text-primary"
                      @click="shopLists(row)"
                      >{{ row.shop_name }}</span
                    >
                  </div>
                </div>
              </template>
            </el-table-column>
            <el-table-column
              prop="area_name"
              label="商圈"
              width="110"
            ></el-table-column>
            <el-table-column prop="job_name" label="岗位" width="110">
              <template slot-scope="{ row }">
                <span>{{ row.job_name }}</span>
                <span v-if="row.job_level && row.job_name"
                  >({{ row.job_level | jobLevel }})</span
                >
              </template>
            </el-table-column>
            <el-table-column
              prop="start_date"
              label="任务开始 ~ 结束时间"
              width="200px"
            >
              <template slot-scope="{ row }">
                <span
                  >{{ row.start_date }} {{ row.start_time }}~{{
                    row.end_time
                  }}</span
                >
              </template>
            </el-table-column>
            <el-table-column label="计划时长" width="110px">
              <template slot-scope="{ row }">
                <span>{{ row.hour_expect }}h</span>
              </template>
            </el-table-column>

            <el-table-column
              prop="task_description"
              width="200"
              label="要求"
            ></el-table-column>
            <el-table-column prop="pay_status" width="100" label="支付状态">
              <template slot-scope="{ row }">
                <span class="text-success" v-if="row.pay_status == '未支付'"
                  >未支付</span
                >
                <span v-if="row.pay_status == '已支付'">已支付</span>
              </template>
            </el-table-column>
            <el-table-column
              prop="creater_name"
              width="110"
              label="创建人"
            ></el-table-column>
            <el-table-column prop="status" label="状态" width="60">
              <template slot-scope="{ row }">
                <span class="text-success" v-if="row.status == '10'"
                  >待分配</span
                >
                <span class="text-primary" v-if="row.status == '15'"
                  >待下发</span
                >
                <span class="text-primary" v-if="row.status == '20'"
                  >已下发</span
                >
                <span class="text-gray" v-if="row.status == '30'">已确认</span>
                <span class="text-warning" v-if="row.status == '40'"
                  >已签到</span
                >
                <span
                  class="text-warning"
                  v-if="row.status == '50' || row.status == '80'"
                  >已完成</span
                >
                <span class="text-default" v-if="row.status == '60'"
                  >已撤回</span
                >
                <span class="text-danger" v-if="row.status == '70'"
                  >已取消</span
                >
                <!-- <span class="text-success" v-if="row.status == '80'">已结算</span> -->
              </template>
            </el-table-column>
            <!-- 异常状态动态显示 -->
            <el-table-column prop="" label="异常状态">
              <template slot-scope="{ row }">
                <div>
                  <div v-if="row.abnormal.length != 0">
                    <div v-for="(item, index) in row.abnormal" :key="index">
                      <span>{{ item }}</span>
                    </div>
                  </div>
                  <div v-if="row.abnormal.length == 0"></div>
                </div>
              </template>
            </el-table-column>
            <!-- <el-table-column prop="hour_delay" label="延时T" min-width="60" align="center"></el-table-column> -->
            <el-table-column
              label="操作"
              :width="
                status == 100 || status == 300 || status == 20
                  ? 170
                  : status == 10
                  ? 100
                  : 130
              "
              fixed="right"
            >
              <template slot-scope="{ row, $index }">
                <el-link
                  :underline="false"
                  type="danger"
                  v-if="
                    row.status == 15 ||
                    row.status == 20 ||
                    row.status == 30 ||
                    row.status == 40 ||
                    row.status == 50
                  "
                  @click="withdraw(row, $index)"
                  >撤回</el-link
                >
                <el-link
                  :underline="false"
                  type="info"
                  v-if="
                    row.status == 10 ||
                    row.status == 20 ||
                    row.status == 30 ||
                    row.status == 40 ||
                    row.status == 50 ||
                    row.status == 60
                  "
                  @click="editBtn(row, $index)"
                  >修改</el-link
                >
                <el-link
                  :underline="false"
                  type="info"
                  v-if="row.status == 15"
                  @click="distributionAll(row, $index)"
                  >下发</el-link
                >
                <el-link
                  :underline="false"
                  type="danger"
                  v-if="
                    row.status == 10 ||
                    row.status == 15 ||
                    row.status == 20 ||
                    row.status == 30 ||
                    row.status == 40 ||
                    row.status == 50 ||
                    row.status == 60
                  "
                  @click="redactBtn(row, $index)"
                  >取消</el-link
                >
                <el-link
                  :underline="false"
                  v-if="row.status == 20"
                  @click="signIn(row, $index)"
                  >签到</el-link
                >
              </template>
            </el-table-column>
          </el-table>
        </template>
      </div>

      <!-- 下面部分 -->
      <div class="pt_20 px_10">
        <el-col :span="2">
          <el-button type="default" @click="downloadOrder()" round size="mini"
            >导出</el-button
          >
        </el-col>
        <el-form
          :inline="true"
          :model="ruleForm"
          class="form-inline"
          @keyup.enter.native="shearchBtn2()"
        >
          <div class="next_top">
            <el-form-item
              ><el-input
                size="mini"
                class="w_80"
                v-model="next_name"
                placeholder="姓名"
              ></el-input
            ></el-form-item>
            <el-form-item
              ><el-input
                size="mini"
                class="w_110"
                v-model="next_mobile"
                placeholder="手机号"
              ></el-input
            ></el-form-item>

            <el-form-item>
              <el-date-picker
                size="mini"
                class="w_90i"
                v-model="next_date"
                type="date"
                value-format="yyyy-MM-dd"
                format="MM-dd"
                placeholder="选择日期"
                :disabled="next_date_disabled"
              ></el-date-picker>
            </el-form-item>

            <el-form-item>
              <el-select
                size="mini"
                class="w_120"
                v-model="next_area_arr"
                placeholder="商圈"
                @change="changeBtndialogarea_next"
                :disabled="next_area_arr_disabled"
              >
                <el-option
                  label="不限"
                  value=""
                  v-if="recommend_tag == 1 || recommend_tag == 3"
                ></el-option>
                <el-option
                  v-for="item in areaList"
                  :key="item.id"
                  :label="item.area_name"
                  :value="`${item.id}|${item.area_name}`"
                ></el-option>
              </el-select>
            </el-form-item>
            <el-form-item>
              <el-select
                size="mini"
                class="w_110"
                v-model="next_type_arr"
                placeholder="岗位"
                @change="changeBtndialogtype_next"
                :disabled="next_type_arr_disabled"
              >
                <el-option
                  v-for="item in TypeArr"
                  :key="item.id"
                  :label="item.label_name"
                  :value="`${item.id}|${item.label_name}`"
                ></el-option>
              </el-select>
            </el-form-item>

            <el-form-item>
              <el-time-select
                class="w_80i"
                v-model="onStreamTimeStart"
                :picker-options="{
                  start: '00:00',
                  step: '00:30',
                  end: '23:30',
                }"
                placeholder="开始"
                :disabled="onStreamTimeStart_disabled"
              >
              </el-time-select>
            </el-form-item>

            <el-form-item>
              <el-time-select
                class="w_80i"
                v-model="onStreamTimeEnd"
                :picker-options="{
                  start: '00:00',
                  step: '00:30',
                  end: '23:30',
                }"
                placeholder="结束"
                :disabled="onStreamTimeEnd_disabled"
              >
              </el-time-select>
            </el-form-item>

            <el-form-item>
              <el-select
                size="mini"
                class="w_60"
                v-model="next_sex"
                placeholder="性别"
              >
                <el-option label="不限" value=""></el-option>
                <el-option label="男" value="male"></el-option>
                <el-option label="女" value="female"></el-option>
              </el-select>
            </el-form-item>

            <el-form-item
              ><el-input
                size="mini"
                class="w_50"
                v-model="next_start"
                placeholder="最小"
              ></el-input
            ></el-form-item>
            <el-form-item>~</el-form-item>
            <el-form-item
              ><el-input
                size="mini"
                class="w_70"
                v-model="next_next"
                placeholder="最大年龄"
              ></el-input
            ></el-form-item>

            <el-button
              size="mini"
              type="primary"
              class="round-right"
              @click="shearchBtn2"
              native-type="button"
              >搜索</el-button
            >
            <el-button size="mini" round @click="resetBtn2">重置</el-button>
          </div>

          <div class="next_button f1">
            <el-button
              size="mini"
              :type="recommend_tag == 1 ? 'primary' : 'default'"
              round
              @click="recommend(1)"
              >全部</el-button
            >
            <el-button
              size="mini"
              :type="
                recommend_tag == 2 || recommend_tag == 4 ? 'success' : 'default'
              "
              round
              @click="recommend(2)"
              >推荐</el-button
            >
            <el-button
              size="mini"
              :type="recommend_tag == 3 ? 'success' : 'default'"
              round
              @click="recommend2()"
              >报名</el-button
            >
            <!-- TODO: 多等级 -->
            <!-- <el-button
              size="mini"
              v-if="recommend_tag == 2 || recommend_tag == 4"
              :type="recommend_tag == 4 ? 'success' : 'default'"
              round
              @click="recommend(4)"
            >
              推荐更多人才
            </el-button> -->
            <span
              v-if="recommend_tag == 2 || recommend_tag == 4"
              @click="recommend(4)"
            >
              <el-checkbox v-model="checkRecommend"></el-checkbox>
              推荐更多人才
            </span>
          </div>
        </el-form>
      </div>

      <div class="tableMaxBox">
        <template>
          <!-- 表格部分 -->
          <el-table :data="centerLists" stripe>
            <el-table-column prop="id" label="序号" width="60" align="center">
              <template slot-scope="{ $index }">
                <span>{{ $index + 1 }}</span>
              </template>
            </el-table-column>
            <el-table-column prop="name" label="姓名" width="100">
              <template slot-scope="{ row }">
                <el-tooltip effect="light" placement="top" :open-delay="500">
                  <div class="wrap_show" slot="content">
                    <div>
                      <img :src="user_history.avatar" alt="头像" />
                      <el-rate
                        v-model="user_history.level"
                        :colors="colors"
                        disabled
                        style="margin-top: 10px"
                      ></el-rate>
                    </div>
                    <div>
                      <div class="show_line">
                        <div style="width: 110px; text-align: right">
                          平台服务经历：
                        </div>
                        <div v-if="user_history.service_history.length != 0">
                          <div
                            v-for="(
                              item, index
                            ) in user_history.service_history"
                            :key="index"
                          >
                            <span
                              v-if="item.is_this == false"
                              style="display: inline-block; width: 130px"
                              >{{ item.shop_name }}</span
                            >
                            <span
                              v-if="item.is_this == true"
                              style="
                                display: inline-block;
                                width: 130px;
                                color: var(--orange1);
                              "
                              >{{ item.shop_name }}</span
                            >
                            <span v-if="item.is_this == false"
                              >{{ item.task_num }}次</span
                            >
                            <span
                              v-if="item.is_this == true"
                              style="color: var(--orange1)"
                              >{{ item.task_num }}次</span
                            >
                          </div>
                        </div>
                        <div v-if="user_history.service_history.length == 0">
                          无
                        </div>
                      </div>
                      <div class="show_line">
                        <div style="width: 110px; text-align: right">
                          工作经历：
                        </div>
                        <div v-if="user_history.task_history.length != 0">
                          <div
                            v-for="(item, index) in user_history.task_history"
                            :key="index"
                          >
                            <span
                              >{{ item.start_time }}至{{ item.end_time }}</span
                            >
                            <span>{{ item.enterprise_name }}</span>
                            <span>{{ item.position }}</span>
                          </div>
                        </div>
                        <div v-if="user_history.task_history.length == 0">
                          无
                        </div>
                      </div>
                      <div class="show_line">
                        <div style="width: 110px; text-align: right">
                          学历：
                        </div>
                        <div v-if="user_history.education != ''">
                          <div>
                            <span>{{ user_history.education }}</span>
                          </div>
                        </div>
                        <div v-if="user_history.education == ''">
                          <div>
                            <span>无</span>
                          </div>
                        </div>
                      </div>
                      <div class="show_line">
                        <div style="width: 110px; text-align: right">
                          常驻地址：
                        </div>
                        <div v-if="user_history.address != ''">
                          <div>
                            <span
                              >{{ user_history.address }}&nbsp;{{
                                user_history.detailed_address
                              }}</span
                            >
                          </div>
                        </div>
                        <div v-if="user_history.address == ''">
                          <div>
                            <span>无</span>
                          </div>
                        </div>
                      </div>
                    </div>
                  </div>
                  <div>
                    <span
                      :class="[
                        row.is_bind == 1 ? 'text-danger' : '',
                        'pointer',
                        'u',
                        'text-primary',
                      ]"
                      @mouseover="cellMouseEnter(row)"
                      @mouseout="cellMouseLeave"
                      @click="toPersonnelListHx(row)"
                      >{{ row.name }}</span
                    >
                    <!-- <span
											v-if="row.newPeople == 1"
											style="background: #c93a32; color: #fff; padding: 2px 3px; border-radius: 3px;"
											>新</span
										>
										<span
											v-if="row.work_status == 2"
											style="background: #c93a32; color: #fff; padding: 2px 3px; border-radius: 3px;"
											>下线</span
										>

										<span
											v-if="row.is_hui == 1"
											style="background: #c93a32; color: #fff; padding: 2px 3px; border-radius: 3px;"
											>回</span
										> -->
                    <div style="overflow: auto" v-if="row.newPeople == 1">
                      <div class="show-warn">新</div>
                    </div>

                    <div style="overflow: auto" v-if="row.work_status == 2">
                      <div class="show-warn">下线</div>
                    </div>

                    <div style="overflow: auto" v-if="row.is_hui == 1">
                      <div class="show-warn">回</div>
                    </div>

                    <div
                      style="overflow: auto"
                      v-if="row.is_black == 'platform'"
                    >
                      <div class="show-warn">平台黑名单</div>
                    </div>

                    <div style="overflow: auto" v-if="row.is_black == 'shop'">
                      <div class="show-warn">店铺黑名单</div>
                    </div>
                  </div>
                </el-tooltip>
              </template>
            </el-table-column>
            <el-table-column
              prop="work_type"
              label="人才类型"
              width="100"
              align="center"
            >
              <template slot-scope="{ row }">
                <span v-if="row.work_type == '1'"
                  >兼职({{ row.recruitment }})</span
                >
                <span v-if="row.work_type == '2'"
                  >全职({{ row.recruitment }})</span
                >
              </template>
            </el-table-column>
            <el-table-column
              prop="mobile"
              label="电话"
              width="100"
              align="center"
            ></el-table-column>
            <el-table-column
              prop="level"
              label="星级"
              width="50"
              align="center"
            >
              <template slot-scope="{ row }">
                <span>{{ row.level }}星</span>
              </template>
            </el-table-column>
            <el-table-column
              prop="gender"
              label="性别"
              width="50"
              align="center"
            >
              <template slot-scope="{ row }">
                <span v-if="row.gender == 'male'">男</span>
                <span v-if="row.gender == 'female'">女</span>
                <span v-if="row.gender == 'other'">未知</span>
              </template>
            </el-table-column>
            <el-table-column
              prop="age"
              label="年龄"
              width="50"
              align="center"
            ></el-table-column>
            <el-table-column
              prop="signed_time"
              label="审核时间"
              width="130"
              align="center"
            >
              <template slot-scope="{ row }">
                <span>{{ row.sign_info.signed_time | dateFormat }}</span>
              </template>
            </el-table-column>
            <el-table-column
              prop="distance"
              label="距离"
              width="100"
              align="center"
            >
              <template slot-scope="{ row }">
                <span v-if="row.distance">{{
                  row.distance | distancUnit
                }}</span>
              </template>
            </el-table-column>
            <el-table-column label="健康证" align="center" width="75px">
              <template slot-scope="{ row }">
                <span
                  class="text-success"
                  v-if="row.certificate_health_status == '1'"
                  >有</span
                >
                <span
                  class="text-danger"
                  v-if="row.certificate_health_status == '2'"
                  >无</span
                >
              </template>
            </el-table-column>
            <el-table-column
              prop="next_date2"
              label="日期"
              width="120"
              align="center"
            ></el-table-column>
            <el-table-column label="报名状态" align="center" width="75px">
              <template slot-scope="{ row }">
                <div>
                  <span class="text-danger" v-if="row.is_appointment == '-1'"
                    >未报名</span
                  >
                  <span class="text-success" v-if="row.is_appointment == '1'"
                    >已报名</span
                  >
                  <span class="text-danger" v-if="row.is_appointment == '2'"
                    >已录用</span
                  >
                  <span class="text-danger" v-if="row.is_appointment == '3'"
                    >未录用</span
                  >
                </div>
              </template>
            </el-table-column>
            <el-table-column
              prop="is_set"
              label="设置类别"
              width="100"
              align="center"
            >
              <template slot-scope="{ row }">
                <span :class="row.is_set == 1 ? 'text-success' : ''">
                  {{ row.is_set | surviveSet }}
                  <el-tooltip
                    v-if="row.no_work_reason"
                    class="item"
                    effect="dark"
                    :content="row.no_work_reason"
                    placement="top-start"
                  >
                    <i
                      class="el-icon-warning"
                      style="color: #ff8040; font-size: 25px"
                    ></i>
                  </el-tooltip>
                </span>
              </template>
            </el-table-column>
            <el-table-column
              prop="intersection_time"
              label="空闲时段"
              width="120"
            >
              <template slot-scope="{ row }">
                <el-tooltip effect="dark" placement="top" :open-delay="500">
                  <div slot="content">
                    <div v-for="(item, index) in user_historySD" :key="index">
                      <span class="mr_10 mb_10">{{ item.week }}</span>
                      <span
                        class="mr_10 mb_10"
                        v-for="(itemarr, indexss) in item.free_time"
                        :key="indexss"
                        >{{ itemarr[0] }}-{{ itemarr[1] }}</span
                      >
                      <span class="mb_10" v-if="item.is_set == 1">日程</span>
                      <span class="mb_10" v-if="item.is_set == 2">偏好</span>
                    </div>
                  </div>

                  <div
                    @mouseover="cellMouseEnterSD(row)"
                    @mouseout="cellMouseEnterSDLeave"
                  >
                    <div v-if="row.intersection_time.length != 0">
                      <h4
                        style="cursor: pointer"
                        v-for="(items, indexs) in row.intersection_time"
                        :key="indexs"
                      >
                        {{ items.start }}-{{ items.end }}
                      </h4>
                    </div>
                    <div v-if="row.intersection_time.length == 0">
                      <h4 style="cursor: pointer">全天休息</h4>
                    </div>
                  </div>
                </el-tooltip>
              </template>
            </el-table-column>
            <el-table-column
              prop="job_types"
              label="岗位"
              width="140"
              align="center"
            >
              <template slot-scope="{ row }">
                <span :title="row.job_types">{{ row.job_types_lang }}</span>
              </template>
            </el-table-column>
            <el-table-column
              prop="task_sum"
              label="近30天服务次数"
              min-width="80"
              align="center"
            >
              <template slot-scope="{ row }">
                <span>{{ row.task_sum }}</span>
              </template>
            </el-table-column>
            <el-table-column
              prop="task_num"
              label="任务"
              width="60"
              align="center"
            >
              <template slot-scope="{ row }">
                <el-tooltip
                  effect="dark"
                  placement="top"
                  :open-delay="500"
                  v-if="row.taskinfo.length != 0"
                >
                  <div slot="content">
                    <div
                      v-for="(item, index) in row.taskinfo"
                      :key="index"
                      style="margin-bottom: 10px"
                    >
                      <span class="mr_10 mb_10">{{ item.shop_name }}：</span>
                      <span class="mr_10 mb_10"
                        >{{ item.start_time }}-{{ item.end_time }}</span
                      >
                    </div>
                  </div>
                  <div>
                    <!-- 点击跳转任务列表，携带人的名字过去 -->
                    <h4 style="cursor: pointer" @click="toTasklist(row)">
                      {{ row.task_num }}
                    </h4>
                  </div>
                </el-tooltip>
                <div v-if="row.taskinfo.length == 0">
                  <!-- 点击跳转任务列表，携带人的名字过去 -->
                  <h4 style="cursor: pointer" @click="toTasklist(row)">
                    {{ row.task_num }}
                  </h4>
                </div>
              </template>
            </el-table-column>
            <el-table-column
              prop="task_hours"
              label="已分配时长"
              min-width="60"
              align="center"
            >
              <template slot-scope="{ row }">
                <el-tooltip
                  effect="dark"
                  placement="top"
                  :open-delay="500"
                  v-if="row.taskinfo.length != 0"
                >
                  <div slot="content">
                    <div
                      v-for="(item, index) in row.taskinfo"
                      :key="index"
                      style="margin-bottom: 10px"
                    >
                      <span class="mr_10 mb_10">{{ item.shop_name }}：</span>
                      <span class="mr_10 mb_10"
                        >{{ item.start_time }}-{{ item.end_time }}</span
                      >
                    </div>
                  </div>
                  <div>
                    <!-- 点击跳转任务列表，携带人的名字过去 -->
                    <h4
                      style="cursor: pointer; color: #3a8ee6"
                      @click="toTasklist(row)"
                    >
                      {{ row.task_hours }}h
                    </h4>
                  </div>
                </el-tooltip>
                <div v-if="row.taskinfo.length == 0">
                  <!-- 点击跳转任务列表，携带人的名字过去 -->
                  <h4
                    style="cursor: pointer; color: #3a8ee6"
                    @click="toTasklist(row)"
                  >
                    {{ row.task_hours }}h
                  </h4>
                </div>
              </template>
            </el-table-column>
            <el-table-column
              prop="task_hours"
              label="空闲时长"
              min-width="60"
              align="center"
            >
              <template slot-scope="{ row }">
                <div>
                  <h4 style="cursor: pointer">{{ row.free_hours }}h</h4>
                </div>
              </template>
            </el-table-column>
            <el-table-column prop="area_name" label="推荐原因" min-width="120">
              <template slot-scope="{ row }">
                <el-tooltip
                  effect="dark"
                  placement="top"
                  v-if="row.score_infos[0].text != ''"
                >
                  <div slot="content">
                    <span
                      class="tooltip"
                      v-for="(item, index) in row.score_infos"
                      :key="index"
                      >{{ item.text }}</span
                    >
                  </div>
                  <span style="cursor: pointer">{{ row.score_sum }}</span>
                </el-tooltip>
                <div v-if="row.score_infos[0].text == ''">
                  <span style="cursor: pointer">{{ row.score_sum }}</span>
                </div>
              </template>
            </el-table-column>
            <el-table-column
              label="操作"
              width="160"
              fixed="right"
              align="center"
            >
              <template slot-scope="{ row, $index }">
                <el-button
                  v-if="row.is_appointment != '2'"
                  type="success"
                  round
                  size="mini"
                  @click="fenpeiBtn(row, $index)"
                  >分配</el-button
                >
                <el-button
                  type="primary"
                  round
                  size="mini"
                  @click="recordBtn(row, $index)"
                  >记录</el-button
                >
              </template>
            </el-table-column>
          </el-table>
          <!-- 分页组件 -->
          <page
            :total="total2"
            :pageNums="pageNum2"
            @pagedata="onChildValue2"
            class="mt_20"
          ></page>
        </template>
      </div>
    </div>

    <!-- 任务取消 -->
    <el-dialog
      :title="diaTitle"
      :visible.sync="StateShowStop"
      width="560"
      :close-on-click-modal="false"
      @close="hiddenRY"
    >
      <div class="auditCentent">
        <div class="row-info clear">
          <div class="fl title-key">
            <i class="lhadmin lhadmin-wujiaoxing"></i><span>责任方：</span>
          </div>
          <div class="fl list-cont">
            <el-select v-model="cancel.zrf" placeholder="请选择">
              <el-option
                v-for="(item, index) in all_revoke.cancel"
                :key="index"
                :label="item.name"
                :value="index"
                >{{ item.name }}</el-option
              >
            </el-select>
          </div>
        </div>
        <div class="row-info clear">
          <div class="fl title-key">
            <i class="lhadmin lhadmin-wujiaoxing"></i><span>类型：</span>
          </div>
          <div class="fl list-cont">
            <el-select v-model="cancel.type" placeholder="请选择">
              <el-option
                v-for="(item, index) in cancel_type"
                :key="index"
                :label="item.name"
                :value="index"
                >{{ item.name }}</el-option
              >
            </el-select>
          </div>
        </div>
        <div class="row-info clear">
          <div class="fl title-key">
            <i class="lhadmin lhadmin-wujiaoxing"></i><span>原因：</span>
          </div>
          <div class="fl list-cont">
            <el-select v-model="cancel.reason" placeholder="请选择">
              <el-option
                v-for="item in cancel_reason"
                :key="item.id"
                :label="item.title"
                :value="item.id"
              ></el-option>
            </el-select>
          </div>
        </div>
        <div class="row-info clear">
          <div class="fl title-key"><span>备注：</span></div>
          <div class="fl list-cont">
            <el-input
              type="textarea"
              :rows="8"
              :cols="44"
              placeholder=""
              v-model="cancel.bz"
            ></el-input>
          </div>
        </div>
        <div style="color: #d9001b; margin-left: 100px">
          注意：任务取消后会将任务金额原路退回给商户
        </div>
      </div>
      <div slot="footer" class="dialog-footer">
        <span class="btnOK mr_20" @click="addMenuBtn()">确 定</span>
        <span class="resetBtn" @click="hiddenRY">取 消</span>
      </div>
    </el-dialog>
    <!-- 任务撤销 -->
    <el-dialog
      :title="diaTitle"
      :visible.sync="StateShowcx"
      width="560"
      :close-on-click-modal="false"
      @close="hiddenRY"
    >
      <div class="auditCentent">
        <div class="row-info clear">
          <div class="fl title-key">
            <i class="lhadmin"></i><span>责任方：</span>
          </div>
          <div class="fl list-cont">
            <el-select v-model="revoke.zrf" placeholder="请选择">
              <el-option
                v-for="(item, index) in all_revoke.withdraw"
                :key="index"
                :label="item.name"
                :value="index"
                >{{ item.name }}</el-option
              >
            </el-select>
          </div>
        </div>
        <div class="row-info clear">
          <div class="fl title-key">
            <i class="lhadmin"></i><span>类型：</span>
          </div>
          <div class="fl list-cont">
            <el-select v-model="revoke.type" placeholder="请选择">
              <el-option
                v-for="(item, index) in revoke_type"
                :key="index"
                :label="item.name"
                :value="index"
                >{{ item.name }}</el-option
              >
            </el-select>
          </div>
        </div>
        <div class="row-info clear">
          <div class="fl title-key">
            <i class="lhadmin"></i><span>原因：</span>
          </div>
          <div class="fl list-cont">
            <el-select v-model="revoke.reason" placeholder="请选择">
              <el-option
                v-for="item in revoke_reason"
                :key="item.id"
                :label="item.title"
                :value="item.id"
              ></el-option>
            </el-select>
          </div>
        </div>
        <div class="row-info clear">
          <div class="fl title-key">
            <i class="lhadmin"></i><span>备注：</span>
          </div>
          <div class="fl list-cont">
            <el-input
              type="textarea"
              :rows="8"
              :cols="44"
              placeholder=""
              v-model="revoke.bz"
            ></el-input>
          </div>
        </div>
      </div>
      <div slot="footer" class="dialog-footer">
        <span class="btnOK mr_20" @click="addCxBtn()">确 定</span>
        <span class="resetBtn" @click="hiddenRY">取 消</span>
      </div>
    </el-dialog>
    <el-dialog
      :title="diaTitle"
      :visible.sync="FPShowStop"
      width="560px"
      :close-on-click-modal="false"
    >
      <div class="auditCentent">
        <span>确认要分配给该员工吗？</span>
      </div>
      <div slot="footer" class="dialog-footer">
        <span class="btnOK mr_20" @click="next()">确 定</span>
        <span class="resetBtn" @click="hiddenRY">取 消</span>
      </div>
    </el-dialog>
    <!-- 第二次弹框 -->
    <el-dialog
      :title="diaTitle"
      :visible.sync="NextShow"
      width="560"
      :close-on-click-modal="false"
    >
      <div class="auditCentent">
        <el-table
          :data="demandInfowhere"
          stripe
          @selection-change="handleSelectionSelect"
        >
          <el-table-column type="selection"></el-table-column>
          <el-table-column prop="sn" label="任务编号" width="150px">
            <template slot-scope="{ row }">
              <span class="u text-primary">{{ row.sn }}</span>
            </template>
          </el-table-column>
          <el-table-column prop="job_name" label="任务名称" width="90px">
            <template slot-scope="{ row }">
              <span class="u text-primary"
                >{{ row.job_name }}&nbsp;&nbsp;{{ row.hour_expect }}h</span
              >
            </template>
          </el-table-column>
          <el-table-column prop="start_time" label="任务开始/结束时间">
            <template slot-scope="{ row }">
              <span>{{ row.start_time }} - {{ row.end_time }}</span>
            </template>
          </el-table-column>
        </el-table>
      </div>
      <div slot="footer" class="dialog-footer">
        <span class="btnOK mr_20" @click="distribution()">是</span>
        <span class="resetBtn" @click="NextShow = false">否</span>
      </div>
    </el-dialog>
    <!-- 修改任务-弹框 -->
    <el-dialog
      :title="diaTitle"
      :visible.sync="TaskEdit"
      width="800px"
      :close-on-click-modal="false"
    >
      <div class="auditCentent">
        <el-row>
          <el-col :span="12">
            <div class="row-info clear">
              <div class="fl title-key">任务编号</div>
              <div class="fl list-cont bb">
                <el-input v-model="edit_task_sn" disabled></el-input>
              </div>
            </div>
          </el-col>
          <el-col :span="12">
            <div class="row-info clear">
              <div class="fl title-key">任务开始</div>
              <div class="fl list-cont bb">
                <el-input v-model="edit_time1" disabled></el-input>
              </div>
            </div>
          </el-col>
          <el-col :span="12">
            <div class="row-info clear">
              <div class="fl title-key">结束时间</div>
              <div class="fl list-cont bb">
                <el-input v-model="edit_time2" disabled></el-input>
              </div>
            </div>
          </el-col>
          <el-col :span="12">
            <div class="row-info clear">
              <div class="fl title-key">计划时长</div>
              <div class="fl list-cont b_sj">
                <el-input v-model="edit_date" placeholder disabled></el-input>
              </div>
              <div
                class="fl title-key"
                style="width: 50px; text-align: left; margin-left: 10px"
              >
                h
              </div>
            </div>
          </el-col>
          <el-col :span="12">
            <div class="row-info clear">
              <div class="fl title-key">签到时间</div>
              <div class="fl list-cont bb">
                <el-date-picker
                  v-model="edit_checkin_time"
                  type="datetime"
                  value-format="yyyy-MM-dd HH:mm:ss"
                  placeholder=""
                  :disabled="edit_static == 20 || edit_static == 30"
                  @change="edit_checkin_time_change()"
                ></el-date-picker>
              </div>
            </div>
          </el-col>
          <el-col :span="12">
            <div class="row-info clear">
              <div class="fl title-key">完成时间</div>
              <div class="fl list-cont bb">
                <el-date-picker
                  v-model="edit_finish_time"
                  type="datetime"
                  value-format="yyyy-MM-dd HH:mm:ss"
                  placeholder=""
                  :disabled="this.edit_static == 50 ? false : true"
                  @change="edit_finish_time_change()"
                ></el-date-picker>
              </div>
            </div>
          </el-col>
          <el-col :span="12">
            <div class="row-info clear">
              <div class="fl title-key">实际时长</div>

              <div class="fl list-cont b_sj">
                <el-input
                  v-model="edit_hour_actual"
                  placeholder
                  disabled
                ></el-input>
              </div>
              <div
                class="fl title-key"
                style="width: 50px; text-align: left; margin-left: 10px"
              >
                h
              </div>
            </div>
          </el-col>
          <el-col :span="12">
            <!--						<div class="row-info clear" v-if="edit_is_prepay != 1">-->
            <!--							<div class="fl title-key">价格</div>-->
            <!--							<div class="fl list-cont b_sj">-->
            <!--								<el-input v-model="amout_shop" placeholder></el-input>-->
            <!--							</div>-->
            <!--							<div class="fl title-key" style="width: 50px; text-align: left; margin-left: 10px;">元/小时</div>-->
            <!--						</div>-->
          </el-col>
          <el-col :span="12">
            <div class="row-info clear" v-if="edit_static2 != 50">
              <div class="fl title-key">状态</div>

              <div class="fl list-cont b">
                <!-- 待分配 -->
                <el-select
                  v-model="edit_static"
                  v-if="edit_static2 == 10"
                  placeholder="请选择"
                  @change="abelEadit"
                >
                  <el-option label="待分配" value="10">待分配</el-option>
                  <!-- <el-option label="已完成" value="50">已完成</el-option> -->
                </el-select>
                <!-- 待下发 -->
                <el-select
                  v-model="edit_static"
                  v-if="edit_static2 == 15"
                  placeholder="请选择"
                  @change="abelEadit"
                >
                  <el-option label="待下发" value="15">待下发</el-option>
                  <!-- <el-option label="已完成" value="50">已完成</el-option> -->
                </el-select>
                <!-- 已下发 -->
                <el-select
                  v-model="edit_static"
                  v-if="edit_static2 == 20"
                  placeholder="请选择"
                  @change="abelEadit"
                >
                  <el-option label="已下发" value="20">已下发</el-option>
                  <!-- <el-option label="已完成" value="50">已完成</el-option> -->
                </el-select>
                <!-- 已确认 -->
                <el-select
                  v-model="edit_static"
                  v-if="edit_static2 == 30"
                  placeholder="请选择"
                  @change="abelEadit"
                >
                  <el-option label="已确认" value="30">已确认</el-option>
                  <!-- <el-option label="已完成" value="50">已完成</el-option> -->
                </el-select>
                <!-- 已签到 -->
                <el-select
                  v-model="edit_static"
                  v-if="edit_static2 == 40"
                  placeholder="请选择"
                  @change="abelEadit"
                >
                  <el-option label="已签到" value="40">已签到</el-option>
                  <!-- <el-option label="已完成" value="50">已完成</el-option> -->
                </el-select>
                <!-- 已完成 -->
                <!-- <el-select v-model="edit_static" v-if="edit_static2 == 50" placeholder="请选择">
							<el-option label="已完成" value="50">已完成</el-option>
						</el-select> -->
                <!-- 已撤回 -->
                <el-select
                  v-model="edit_static"
                  v-if="edit_static2 == 60"
                  placeholder="请选择"
                  @change="abelEadit"
                >
                  <el-option label="已撤回" value="60">已撤回</el-option>
                  <!-- <el-option label="已完成" value="50">已完成</el-option> -->
                </el-select>
              </div>
            </div>
          </el-col>
          <el-col :span="24">
            <div class="row-info clear">
              <div class="fl title-key">备注</div>
              <div class="fl list-cont b_sj">
                <el-input
                  type="textarea"
                  :rows="4"
                  :cols="30"
                  maxlength="100"
                  show-word-limit
                  placeholder=""
                  v-model="update_remark"
                ></el-input>
              </div>
            </div>
          </el-col>
          <el-col :span="24">
            <div class="row-info clear">
              <div class="fl title-key">人才备注</div>
              <div class="fl list-cont b_sj">
                <el-input
                  type="textarea"
                  :rows="4"
                  :cols="30"
                  maxlength="50"
                  show-word-limit
                  placeholder=""
                  v-model="staff_remark"
                ></el-input>
              </div>
            </div>
          </el-col>
        </el-row>

        <!-- <div class="row-info clear">
					<div class="fl title-key">延时时长</div>

					<div class="fl list-cont b_sj">
						<el-input
							v-model="edit_hour_delay"
							placeholder
							:disabled="this.edit_static == 50 ? true : false"
						></el-input>
					</div>
					<div class="fl title-key" style="width: 50px; text-align: left; margin-left: 10px;">h</div>
				</div> -->
      </div>
      <div slot="footer" class="dialog-footer">
        <span class="btnOK mr_20" @click="taskBtnEdit()">确 定</span>
        <span class="resetBtn" @click="hiddenRY">取 消</span>
      </div>
    </el-dialog>
    <!-- 手动签到-弹框 -->
    <el-dialog
      :title="diaTitle"
      :visible.sync="TaskSignIn"
      width="600px"
      :close-on-click-modal="false"
    >
      <div class="auditCentent">
        <div class="row-info clear">
          <div class="fl title-key">任务编号</div>
          <div class="fl list-cont bb">
            <el-input v-model="edit_task_sn" disabled></el-input>
          </div>
        </div>
        <div class="row-info clear">
          <div class="fl title-key">任务开始</div>
          <div class="fl list-cont bb">
            <el-input v-model="edit_time1" disabled></el-input>
          </div>
        </div>
        <div class="row-info clear">
          <div class="fl title-key">结束时间</div>
          <div class="fl list-cont bb">
            <el-input v-model="edit_time2" disabled></el-input>
          </div>
        </div>
        <div class="row-info clear">
          <div class="fl title-key">计划时长</div>
          <div class="fl list-cont b_sj">
            <el-input v-model="edit_date" placeholder disabled></el-input>
          </div>
          <div
            class="fl title-key"
            style="width: 50px; text-align: left; margin-left: 10px"
          >
            h
          </div>
        </div>
        <div class="row-info clear">
          <div class="fl title-key">签到时间</div>
          <div class="fl list-cont bb">
            <el-date-picker
              v-model="manual_checkin_time"
              type="datetime"
              value-format="yyyy-MM-dd HH:mm:ss"
              placeholder=""
              :default-value="edit_time1"
              :picker-options="{
                disabledDate: (time) => {
                  return time.getTime() > new Date(edit_time2)
                },
                selectableRange: range_time,
              }"
            ></el-date-picker>
          </div>
        </div>
        <div class="row-info clear">
          <div class="fl title-key">备注</div>
          <div class="fl list-cont b_sj">
            <el-input
              type="textarea"
              :rows="6"
              :cols="30"
              placeholder=""
              v-model="manual_remark"
            ></el-input>
          </div>
        </div>
      </div>
      <div slot="footer" class="dialog-footer">
        <span class="btnOK mr_20" @click="taskBtnManual()">确 定</span>
        <span class="resetBtn" @click="hiddenRY">取 消</span>
      </div>
    </el-dialog>
    <el-dialog
      title="分配提示"
      :visible.sync="AssignmentTips"
      width="560px"
      :close-on-click-modal="false"
    >
      <div class="auditCentent">
        <span>以下原因系统认为分配不合理，确定要继续分配吗?</span>
        <div style="margin-top: 20px">
          <p v-for="(item, index) in AssignmentTips_reason" :key="index">
            {{ item }}
          </p>
        </div>
      </div>
      <div slot="footer" class="dialog-footer">
        <span
          class="btnOK mr_20"
          @click="assign(multipleSelectionSelect.toString())"
          v-if="multipleSelectionSelect != 0"
          >确 定</span
        >
        <span
          class="btnOK mr_20"
          @click="assign(multipleSelection.toString())"
          v-if="multipleSelectionSelect == 0"
          >确 定</span
        >
        <span class="resetBtn" @click="hiddenRY">取 消</span>
      </div>
    </el-dialog>
    <!-- 一键下发任务-弹框 -->
    <el-dialog
      :title="diaTitle"
      :visible.sync="StateDistribution"
      width="560px"
      :close-on-click-modal="false"
    >
      <div class="auditCentent">
        <span>{{ StateDistrimessage }}</span>
      </div>
      <div slot="footer" class="dialog-footer">
        <span class="btnOK mr_20" @click="toDistribution()">确 定</span>
        <span class="resetBtn" @click="hiddenRY">取 消</span>
      </div>
    </el-dialog>
    <!-- <el-dialog title="异常记录" :visible.sync="recordStatus" width="560px" :close-on-click-modal="false">
			<div class="auditCentent">
				<span>{{ StateDistrimessage }}</span>
			</div>
			<div slot="footer" class="dialog-footer">
				<span class="btnOK mr_20" @click="toDistribution()">确 定</span>
				<span class="resetBtn" @click="hiddenRY">取 消</span>
			</div>
		</el-dialog> -->

    <el-dialog
      title="异常记录"
      :visible.sync="recordStatus"
      :close-on-click-modal="false"
      class="add-change-log"
      width="850px"
    >
      <!-- @close="closeAddDialog" -->
      <el-form
        inline
        ref="addFormRef"
        label-width="80px"
        class="personnel-type-modify-add-form"
      >
        <el-form-item label="姓名">
          <el-input :value="personnelInfo.name" disabled></el-input>
        </el-form-item>
        <el-form-item label="手机号">
          <el-input :value="personnelInfo.mobile" disabled></el-input>
        </el-form-item>
        <el-form-item label="性别">
          <el-input
            v-if="personnelInfo.gender == 'male'"
            value="男"
            disabled
          ></el-input>
          <el-input
            v-if="personnelInfo.gender == 'female'"
            value="女"
            disabled
          ></el-input>
          <el-input
            v-if="personnelInfo.gender == 'other'"
            value="未知"
            disabled
          ></el-input>
        </el-form-item>

        <el-form-item label="人才类型">
          <el-input
            v-if="personnelInfo.work_type == '1'"
            value="兼职"
            disabled
          ></el-input>
          <el-input
            v-if="personnelInfo.work_type == '2'"
            value="全职"
            disabled
          ></el-input>
        </el-form-item>
        <el-form-item label="年龄">
          <el-input :value="personnelInfo.age" disabled></el-input>
        </el-form-item>
        <el-form-item label="岗位">
          <el-input :value="personnelInfo.job_types" disabled></el-input>
        </el-form-item>
        <el-form-item label="健康证">
          <el-input
            v-if="personnelInfo.certificate_health_status == '1'"
            value="有"
            disabled
          ></el-input>
          <el-input
            v-if="personnelInfo.certificate_health_status == '2'"
            value="无"
            disabled
          ></el-input>
        </el-form-item>
      </el-form>
      <p style="font-size: 16px; color: #303133; margin: 5px 0 10px">
        当前日程安排
      </p>
      <el-table
        :data="richengshezhi"
        stripe
        @selection-change="handleSelectionChangeNext()"
        height="200"
      >
        <el-table-column type="selection" prop="id" align="center" width="50px">
          <template slot-scope="{ $index }">
            <el-checkbox
              v-model="checked[$index].is_set"
              @change="checkboxChange($index)"
              disabled
            ></el-checkbox>
          </template>
        </el-table-column>
        <el-table-column
          v-for="(item, index) in dayArr"
          prop="id"
          :key="index"
          :label="item.day_next + '(' + item.week + ')'"
          align="center"
        >
          <template slot-scope="{ $index }">
            <el-checkbox
              v-model="richengshezhi[$index].arr[index].is_set"
              disabled
              >{{ richengshezhi[$index].arr[index].value }}</el-checkbox
            >
          </template>
        </el-table-column>
      </el-table>
      <div class="row-info clear">
        <div class="fl title-key">
          <i class="lhadmin lhadmin-wujiaoxing"></i>未派工原因
        </div>
        <div class="fl list-cont bb">
          <el-select v-model="nowork.reason_id" placeholder="请选择">
            <el-option
              v-for="(item, index) in notWorkList"
              :key="index"
              :label="item.label_name"
              :value="item.id"
            >
            </el-option>
          </el-select>
        </div>
      </div>
      <div class="row-info clear">
        <div class="fl title-key">不能出工日期</div>
        <div class="fl list-cont bb">
          <el-date-picker
            size="mini"
            type="date"
            class="w_120i"
            value-format="yyyy-MM-dd"
            format="yyyy-MM-dd"
            placeholder="开始日期"
            v-model="nowork.start_date"
          ></el-date-picker>
          ~
          <el-date-picker
            size="mini"
            type="date"
            class="w_120i"
            value-format="yyyy-MM-dd"
            format="yyyy-MM-dd"
            placeholder="结束日期"
            v-model="nowork.end_date"
          ></el-date-picker>
        </div>
      </div>
      <div class="row-info clear">
        <div class="fl title-key">备注</div>
        <div class="fl list-cont bb">
          <el-input
            type="textarea"
            :rows="6"
            :cols="35"
            placeholder="请填写"
            v-model="nowork.remark"
            maxlength="50"
            :show-word-limit="true"
          ></el-input>
        </div>
      </div>
      <span slot="footer" class="dialog-footer">
        <el-button @click="clonseModify">取 消</el-button>
        <el-button type="primary" @click="addModify">保 存</el-button>
      </span>
    </el-dialog>
  </div>
</template>

<script>
let that;
var common = require('../../../static/tool.js')
import { publicData } from '../../../assets/js/data.js'
import { fetchCityList } from '@/api/city.js'
import { fetchShopList, fetchLabelList, fetchAreaList } from '@/api/shop.js'
import { getUserInfo } from '@/api/user.js'
import { fetchUserLevelList } from '@/api/staff.js'

import {
  fetchTaskListPg,
  fetchReasonList,
  queryStatistics,
  taskCancel,
  taskWithdraw,
  taskSave,
  taskInfo,
  taskCheckin,
  taskIssued,
  taskToIssued,
  noWorkReason,
  createNowork
} from '@/api/task.js'
import { fetchUsersInfo } from '@/api/user.js'
export default {
  name: 'ShopList',
  data() {
    return {
      id: '',
      dataMes: '',
      ids: '',
      sn: '',
      default_task_sn: '',
      coordinates_list: '', //位置信息

      recommend_tag: 1,
      ids_name: '',
      fp_staff_id: '', //全景调度centerList的员工id
      fp_staff_name: '', //全景调度centerList的员工名称
      fp_staff_sn: '', //全景调度centerList的员工SN
      agreement: '',
      index: '10',
      windowSizeHeight: document.documentElement.clientHeight, //浏览器可视化窗口的大小
      screenHeight: document.documentElement.clientHeight,
      manageInfo: JSON.parse(sessionStorage.getItem('manageInfo')), //登录信息
      url: common.url,
      head_url: common.head_url,
      //搜索对应值
      task_sn: '', //任务编号
      demand_sn: '', //订单编号
      agent_id: '',
      staff_name: '', //接单人
      mobile: '', //手机号
      area_arr: '', //商圈信息
      area_id: '',
      area_name: '',
      s_time_slot: '',
      s_departmentIds: [],
      s_departmentNames: [],
      type_arr: '', //需求信息
      label_id: '',
      label_name: '',
      shop_id: '', //店铺id
      shop_name: '', //店铺名
      next_shop_sn: '', //店铺sn
      status: '10', //账号状态： 1:正常  2:禁用
      time_type: '2', //时间类型选择
      cityList: [], // 城市列表
      city_val: '',
      city_id: '',
      ruleForm: {
        date1: '', //开始时间
        date2: '' //结束时间
      },

      TypeArr: [],
      demandList: [], //任务列表
      centerLists: [], //全景调度列表
      log_data: [],
      statistic: {
        abnormal: 0, //异常
        assigning: 0, //待分配（待确认+已撤销）
        withdraw: 0, //已撤销
        assigned: 0, //待确认
        all: 0, //所有状态的任务
        issued: 0, //待下发
        cancel: 0 //取消
      }, //任务统计条数
      //向分页组件传值
      total: 0,
      pageNum: '',
      pageSizeNow: '',
      total2: 0,
      pageNum2: '',
      pageSizeNow2: '',
      // 审核状态
      text: '',
      areaList: [], //区域列表
      shopList: [], //店铺列表
      diaTitle: '', //弹框title
      StateShowStart: false,
      StateShowStop: false,
      FPShowStop: false,
      StateShowcx: false,
      StateDistribution: false,
      NextShow: false,
      TaskEdit: false,
      TaskSignIn: false,
      AssignmentTips: false,
      StateDistrimessage: '',
      diaTitle_sn: '',
      AssignmentTips_reason: [], //强制对应文字
      multipleSelection: '',
      //任务修改
      actual_end_time: '', //计费完成时间
      edit_task_sn: '',
      edit_time1: '',
      edit_time2: '',
      edit_date: '',
      edit_checkin_time: '',
      actual_start_time: '', //计费开始时间
      actual_start_time2: '',
      edit_hour_delay: '',
      edit_finish_time: '',
      edit_finish_time2: '',
      edit_hour_actual: '',
      edit_price: '',
      edit_static: '',
      edit_static2: '', //任务详情的值
      amout_shop: '',
      update_remark: '',
      staff_remark: '',
      edit_is_prepay: '',
      // 底部搜索
      next_task_sn: '', //任务id
      next_task_sn2: '', //任务id
      next_name: '',
      next_mobile: '',
      next_date: '',
      next_date2: '',
      onStreamTimeStart: '',
      onStreamTimeEnd: '',
      next_type_arr: '',
      next_label_id: '',
      next_label_name: '',
      next_label_id2: '',
      next_label_name2: '',
      next_sex: '',
      next_start: '',
      next_next: '',
      next_area_arr: '', //商圈信息
      next_area_arr2: '', //商圈信息
      next_area_id: '',
      next_area_id2: '',
      next_area_name: '',
      next_area_name2: '',
      //手动签到
      manual_checkin_time: '',
      manual_remark: '', //签到备注
      manual_task_remark: '', //任务备注

      //推荐按钮点击，底部搜索的部分操作框变灰
      next_date_disabled: false, //选择时间
      onStreamTimeStart_disabled: false, //选择时间
      onStreamTimeEnd_disabled: false, //选择时间
      next_area_arr_disabled: false, //商圈
      next_type_arr_disabled: false, //选择岗位
      next_sex_disabled: false, //选择性别
      next_start_disabled: false, //最小年龄
      next_next_disabled: false, //最大年龄

      //点击分配，二次弹框
      demandInfowhere: '',
      multipleSelectionSelect: [], //选中的序号集合

      all_revoke: [],
      //撤销相关
      revoke: {
        zrf: '',
        type: '',
        reason: '',
        bz: ''
      },
      revoke_type: [], //撤销类型列表
      revoke_reason: [], //撤销原因列表

      //取消相关
      cancel: {
        zrf: '',
        type: '',
        reason: '',
        bz: ''
      },
      cancel_type: [], //取消类型列表
      cancel_reason: [], //取消原因列表
      user_history: {
        avatar: '',
        education: '无',
        level: 0,
        service_history: [],
        task_history: [],
        address: '',
        detailed_address: ''
      }, //请求人员资料信息
      user_historySD: [], //请求空闲时段信息
      // 颜色设定
      colors: ['#cf2e22', '#cf2e22', '#cf2e22'],
      mouseoverdata: '',
      mouseoverdataSD: '',
      // 是否报名
      is_appointment: '',
      start_date_save: '', //时间保持
      range_time: '',
      areaStatus: true,
      recordStatus: false,
      richengshezhi: [],
      checked: [
        {
          is_set: false
        },
        {
          is_set: false
        },
        {
          is_set: false
        },
        {
          is_set: false
        }
      ],
      dayArr: [],
      // 人才详情
      personnelInfo: {},
      notWorkList: [],
      nowork: {},
      agent_reset: 0,
      levelList: '', //用工等级列表
      job_level: '', //任务筛选用工等级
      multi_level: '', //多等级参数
      checkRecommend: false //推荐更多人才
    }
  },
  computed: {
    //撤销相关
    poke_zrf() {
      return this.revoke.zrf.toString()
    },
    //撤销相关
    poke_type() {
      return this.revoke.type.toString()
    },
    //取消相关
    cancels_zrf() {
      return this.cancel.zrf.toString()
    },
    //取消相关
    cancels_type() {
      return this.cancel.type.toString()
    },
    // 手动签到时间
    checkin_time() {
      return this.manual_checkin_time
    },
    //
    city_value() {
      return this.city_val
    }
  },
  watch: {
    //撤销-责任方改变
    poke_zrf(newValue, oldValue) {
      if (newValue != '') {
        this.revoke.type = '' //类型清空
        this.revoke.reason = '' //原因清空
        this.revoke_type = [] //撤销类型列表清空
        this.revoke_reason = [] //撤销原因列表清空
        this.revoke_type = this.all_revoke.withdraw[newValue].child
      } else {
        this.revoke.type = '' //类型清空
        this.revoke.reason = '' //原因清空
        this.revoke_type = [] //撤销类型列表清空
        this.revoke_reason = [] //撤销原因列表清空
        this.revoke_type = []
      }
    },
    //撤销-类型改变
    poke_type(newValue, oldValue) {
      if (newValue != '') {
        this.revoke.reason = '' //原因清空
        this.revoke_reason = this.revoke_type[newValue].child
      } else {
        this.revoke.reason = '' //原因清空
        this.revoke_reason = []
      }
    },
    //取消-责任方改变
    cancels_zrf(newValue, oldValue) {
      console.log('===', newValue)
      if (newValue != '') {
        this.cancel.type = '' //类型清空
        this.cancel.reason = '' //原因清空
        this.cancel_type = [] //取消类型列表清空
        this.cancel_reason = [] //取消原因列表清空
        this.cancel_type = this.all_revoke.cancel[newValue].child
      } else {
        this.cancel.type = '' //类型清空
        this.cancel.reason = '' //原因清空
        this.cancel_type = [] //取消类型列表清空
        this.cancel_reason = [] //取消原因列表清空
        this.cancel_type = []
      }
    },
    //取消-类型改变
    cancels_type(newValue, oldValue) {
      console.log('===', newValue)
      if (newValue != '') {
        this.cancel.reason = '' //原因清空
        this.cancel_reason = this.cancel_type[newValue].child
      } else {
        this.cancel.reason = '' //原因清空
        this.cancel_reason = []
      }
    },
    //商圈改变
    areaList(newValue, oldValue) {
      //上面的列表数据
      this.listShop()
      //下面的列表数据
      this.next_area_arr = this.areaList[0].id + '|' + this.areaList[0].area_name
      this.next_area_id = this.areaList[0].id
      this.next_area_name = this.areaList[0].area_name
      this.next_area_arr2 = this.areaList[0].id + '|' + this.areaList[0].area_name
      this.next_area_id2 = this.areaList[0].id
      this.next_area_name2 = this.areaList[0].area_name
      this.getcenterList()
    },
    // 手动签到弹框--签到时间值
    checkin_time(newValue) {
      if (newValue) {
        this.manual_checkin_time = newValue
        let moment1 = this.$moment(this.manual_checkin_time.substring(0, 10))
        let moment2 = this.$moment(this.edit_time2.substring(0, 10))
        if (moment1.isSame(moment2)) {
          this.range_time = '00:00:00' + '-' + this.edit_time2.substring(11)
        } else {
          this.range_time = '00:00:00' + '-' + '23:59:59'
        }
      }
    }

    // city_value(newVal, oldVal) {
    // 	if (oldVal) {
    // 		let [id, name] = oldVal.split('|')
    // 		if (id === '北京') {
    // 			id = 1
    // 		}
    // 		// 存储旧的商圈数据
    // 		this.selectedAreasMap[`city-${id}`] = this.s_time_slot
    // 	}
    // 	console.log('存储值', this.selectedAreasMap)
    // 	if (newVal && this.city_id) {
    // 		this.listArea(this.city_id) //商圈列表
    // 		this.listUser(this.city_id) //店铺列表
    // 	}
    // }
  },
  beforeCreate() {
    that = this;
  },
  created() {
    //获取商圈列表
    // this.listArea()
    this.selectedAreasMap = {}
    //取消和撤销原因接口
    this.getReasonList()
    // 获取未出工的原因
    this.notWorkReason()
    if (this.$route.query.id) {
      this.id = this.$route.query.id //接收传参
      this.business_id = this.id
    }
    if (!sessionStorage.getItem('manageInfo')) {
      // 判断是否登录
      window.location = 'login.html'
      return
    }
    //判断今天是否周五
    this.ruleForm.date1 = this.date(1) + ' 00:00:00'
    if (this.$moment().day() == 5) {
      this.ruleForm.date2 = this.date(3) + ' 23:59:00'
    } else {
      this.ruleForm.date2 = this.date(1) + ' 23:59:00'
    }

    // 全景调度列表，默认选中时间和商圈
    this.next_date = this.date(0)

    //获取最近七天
    for (let index = 1;index < 8;index++) {
      this.dayArr.push({
        day: this.$moment().add('days', index).format('YYYY-MM-DD'),
        day_next: this.$moment().add('days', index).format('MM-DD'),
        week: this.getWeek(index)
      })
    }
  },
  mounted() {
    //判断是否默认设置商圈
    // if (localStorage.getItem('taskAssignment_area')) {
    // 	this.s_time_slot = localStorage.getItem('taskAssignment_area').split(',')
    // }

    this.alljob_type()
    // this.fetchCityList()
    this.setRichengshezhi()
    this.getchUserLevelList() //用工等级
  },
  methods: {
    date(e) {
      return this.$moment().add('days', e).format('YYYY-MM-DD')
    },
    date_now(e) {
      var date = new Date()
      var seperator1 = '-'
      var seperator2 = ':'
      var month = date.getMonth() + 1 < 10 ? '0' + (date.getMonth() + 1) : date.getMonth() + 1
      var strDate = date.getDate() < 10 ? '0' + date.getDate() : date.getDate()
      var currentdate =
        date.getFullYear() +
        seperator1 +
        month +
        seperator1 +
        strDate +
        ' ' +
        date.getHours() +
        seperator2 +
        date.getMinutes() +
        seperator2 +
        date.getSeconds()
      return currentdate
    },
    time_dis(a, b) {
      // direct_time格式为yyyy-mm-dd hh:mm:ss 指定时间
      var now_time = Date.parse(new Date(a)) //指定时间的时间戳
      var end_time = Date.parse(new Date(b)) //指定时间的时间戳
      if (end_time < now_time) {
        console.log('时间差值0分钟')
        return 0
      } else {
        var time_dis = end_time - now_time
        var minutes = Math.floor(time_dis / (60 * 1000))
        console.log('时间差值' + minutes + '分钟')
        return minutes
      }
    },
    // 获取城市列表
    async fetchCityList() {
      try {
        let ret = await fetchCityList()
        this.cityList = ret.list
        this.city_val = this.cityList[0].city_name
        this.city_id = this.cityList[0].id
      } catch (err) {
        console.log('err:', err)
      }
    },
    // 监听城市val变化
    async changeCity() {
      let [id, name, city_sn] = this.city_val.split('|') // es6 数组解构赋值
      this.city_id = id
      this.city_name = name
      this.city_sn = city_sn
      await this.listUser()
      await this.listArea(this.city_id) //商圈列表
    },
    //获取商铺列表
    async listUser(city_id) {
      try {
        let ret = await fetchShopList({
          sign_status: 30,
          status: 1,
          city_id: this.city_id,
          agent_id: this.agent_id
        })

        this.shop_id = ''
        this.shop_name = ''
        this.shop_sn = ''

        if (ret.list.length) {
          ret.list.forEach(item => {
            item.value = item.name
          })
          this.shopList = ret.list
        } else {
          this.shopList = []
        }
      } catch (err) { }
    },
    //获取用工等级列表
    async getchUserLevelList() {
      try {
        let arr = await fetchUserLevelList()
        this.levelList = this.sortByKey(arr, 'id');
      } catch (err) { }
    },
    //数组对象方法排序:
    sortByKey(array, key) {
      return array.sort(function (a, b) {
        var x = a[key];
        var y = b[key];
        return ((x > y) ? -1 : ((x < y) ? 1 : 0));
      });
    },
    //获取任务列表
    async listShop() {
      //判断时间框是否存在值
      if (!this.ruleForm.date1) {
        this.ruleForm.date1 = ''
        this.$message.error('请选择任务开始时间！')
        return
      }
      if (!this.ruleForm.date2) {
        this.ruleForm.date2 = ''
        this.$message.error('请选择任务结束时间！')
        return
      }
      if (!this.shop_name) {
        this.shop_id = ''
      }
      // if (!this.s_time_slot.length) {
      // 	this.$message.error('请选择商圈！')
      // 	return
      // }
      var s_departmentIds_Arr = []
      this.s_time_slot.forEach(element => {
        let [id, name] = element.split('|')
        s_departmentIds_Arr.push(id.toString())
      })
      let TaskListPgObj = {
        pageSize: this.pageSizeNow,
        page: this.pageNum,
        task_sn: this.task_sn,
        demand_sn: this.demand_sn,
        agent_id: this.agent_id,
        staff_name: this.staff_name,
        mobile: this.mobile,
        shop_id: this.shop_id,
        area_id: s_departmentIds_Arr.toString(),
        label_id: this.label_id,
        time_type: this.time_type,
        city_id: this.city_id,
        job_level: this.job_level,
        start_time: this.ruleForm.date1,
        end_time: this.ruleForm.date2,
        //鼠标移动-显示店铺信息
        source: 'dispatch',
        flow_path: 1
      }
      //排序使用
      if (this.status == 10) {
        //待分配
        TaskListPgObj = {
          ...TaskListPgObj,
          status: '10,60',
          order: JSON.stringify({ shop_id: 1, start_time: 1 })
        }
      } else if (this.status == 100) {
        //超时未确认
        TaskListPgObj = {
          ...TaskListPgObj,
          status: '20',
          abnormal_status: '10',
          order: JSON.stringify({ start_time: 1 })
        }
      } else if (this.status == 300) {
        //全部
        TaskListPgObj = {
          ...TaskListPgObj,
          status: '',
          order: JSON.stringify({ shop_id: 1, start_time: 1 })
        }
      } else if (this.status == 20) {
        //待确认
        TaskListPgObj = {
          ...TaskListPgObj,
          status: this.status,
          order: JSON.stringify({ start_time: 1 })
        }
      } else if (this.status == 15) {
        //待下发
        TaskListPgObj = {
          ...TaskListPgObj,
          status: this.status,
          order: JSON.stringify({ start_time: 1 })
        }
      }

      try {
        let ret = await fetchTaskListPg(TaskListPgObj)
        if (ret && ret.list.length) {
          this.demandList = ret.list
          this.total = ret.count
        } else {
          this.demandList = []
          this.total = 0
        }
        //任务统计条数
        this.statistics_sum()
      } catch (err) {
        console.log(err)
      }
    },
    getcenterList() {
      //全景调度列表
      let fn = new FormData()
      fn.append('pageSize', this.pageSizeNow2) //每页多少条
      fn.append('page', this.pageNum2) //页数
      if (!this.next_date) {
        this.next_date = ''
      }
      if (!this.onStreamTimeStart) {
        this.onStreamTimeStart = ''
      }
      if (!this.onStreamTimeEnd) {
        this.onStreamTimeEnd = ''
      }
      fn.append('task_sn', this.next_task_sn)
      fn.append('is_appointment', this.is_appointment)
      fn.append('job_types', this.next_label_id)
      fn.append('gender', this.next_sex)
      fn.append('work_date', this.next_date)
      fn.append('start_time', this.onStreamTimeStart)
      fn.append('end_time', this.onStreamTimeEnd)
      fn.append('age_start', this.next_start)
      fn.append('age_end', this.next_next)
      fn.append('mobile', this.next_mobile)
      fn.append('name', this.next_name)
      if (this.coordinates_list != '') {
        fn.append('location', JSON.stringify(this.coordinates_list))
      }
      //let post_url = '/dispatch/taskStaffList'
      let post_url = ''
      if (this.recommend_tag == 1) {
        //全部按钮
        console.log('this.next_area_id', this.next_area_id)
        //如果选择的是不限，则将所有的商圈id都传递，格式：id,id
        if (!this.next_area_id) {
          let arrObj = []
          this.areaList.forEach(item => {
            arrObj.push(item.id)
          })
          fn.append('job_areas', arrObj.join(','))
        } else {
          this.next_area_arr = this.next_area_name
          fn.append('job_areas', this.next_area_id)
        }

        post_url = '/dispatch/dispatchAll'
      } else if (this.recommend_tag == 2 && this.next_task_sn != '') {
        this.next_area_arr = this.next_area_name
        fn.append('job_areas', this.next_area_id)
        if (this.checkRecommend) {
          fn.append('multi_level', 1)
        }
        //推荐按钮
        post_url = '/dispatch/dispatchRecommend'
      } else if (this.recommend_tag == 3) {
        //如果选择的是不限，则将所有的商圈id都传递，格式：id,id
        let arrObj = []
        this.areaList.forEach(item => {
          arrObj.push(item.id)
        })
        fn.append('job_areas', arrObj.join(','))

        //报名按钮
        post_url = '/dispatch/dispatchRecommend'
      } else if (this.recommend_tag == 4 && this.next_task_sn != '') {
        this.next_area_arr = this.next_area_name
        fn.append('job_areas', this.next_area_id)
        if (!this.checkRecommend) {
          fn.append('multi_level', 1)
        }
        // fn.append('multi_level', 1)
        //推荐按钮
        post_url = '/dispatch/dispatchRecommend'
      }
      this.$http.post(this.url + post_url, fn).then(
        res => {
          if (res.data.msg == '查询成功' || res.data.code == '200') {
            if (res.data.data != null) {
              //对提示的文字进行处理
              res.data.data.list.forEach(item => {
                var stringResult = item.score_info.split(',')
                item.score_infos = this.objToArr(stringResult)
              })
              //表格的时间显示
              this.next_date2 = this.next_date
              this.centerLists = res.data.data.list
              this.total2 = res.data.data.count
            } else {
              this.centerLists = []
              this.total2 = 0
            }

            if (res.data.data.log_data) {
              this.log_data = res.data.data.log_data
            } else {
              this.log_data = []
            }
          } else if (res.data.code == '201') {
            this.log_data = []
            this.centerLists = []
            this.total2 = 0
          } else if (res.data.code == '8886') {
            //code   8886  登录过期
            sessionStorage.clear()
            this.$alert('登录已过期，请重新登录 !', '提示', {
              confirmButtonText: '确定',
              callback: action => {
                window.location = 'login.html'
              }
            })
            return
          } else {
            this.$message.error(res.data.msg)
            return
          }
        },
        res => {
          this.$message.error('网络错误！')
          return
        }
      )
    },
    //推荐原因的数组对象转换
    objToArr(obj) {
      var arr = []
      for (let i in obj) {
        let o = {}
        o['text'] = obj[i]
        arr.push(o)
      }
      return arr
    },
    //获取选中行的id
    handleSelectionChange(val) {
      // console.log(val)
      if (this.status == 10 || this.status == 15) {
        if (val.length == 0) {
          //取消选中的多选框
          this.multipleSelection = ''
          this.coordinates_list = ''
          this.default_task_sn = ''

          this.recommend(1)
        } else {
          if (val.length >= 2) {
            // 删除索引为0的
            let arrays = val.splice(0, val.length - 1)
            arrays.forEach(row => {
              this.$refs.multipleTable.toggleRowSelection(row) //除了当前点击的，其他的全部取消选中
            })
          }
          //时间存储
          this.start_date_save = val[0].start_date
          this.next_shop_sn = val[0].shop_sn
          this.multipleSelection = val[0].task_sn
          // 位置信息存储
          this.coordinates_list = val[0].location
          //清空底部表格的部分搜索条件
          this.next_name = ''
          this.next_mobile = ''
          this.next_sex = ''
          this.next_start = ''
          this.next_next = ''

          //触发底部的推荐按钮
          this.next_task_sn = val[0].task_sn
          this.next_task_sn2 = val[0].task_sn
          this.next_date = val[0].start_date
          this.next_area_id = val[0].area_id
          this.next_area_id2 = val[0].area_id
          this.next_area_arr = val[0].area_id + '|' + val[0].area_name
          this.next_area_name = val[0].area_name
          //通过default_task_sn，防止多次触发方法
          if (this.default_task_sn == val[0].task_sn) {
          } else {
            this.default_task_sn = val[0].task_sn
            //这里放change该执行的事件
            this.recommend(2)
          }
        }
      }
    },
    shearchBtn() {
      //点击搜索按钮 - 任务sn置为空 - 清空勾选
      this.next_task_sn = ''
      this.recommend_tag = 1
      //不是异常状态
      // 搜索
      this.pageNum = 1
      this.listShop() //上面列表数据
      this.pageNum2 = 1
      this.getcenterList() //下面的列表数据
    },

    shearchBtn2() {
      //判断时间框是否存在值
      if (this.next_date == null) {
        this.$message.error('请选择要查询的日期！')
        return
      }
      // 搜索
      this.pageNum2 = 1
      this.getcenterList()
    },

    async resetBtn() {
      //重置
      await this.resetData() //重置请求数据
      this.pageNum = 1
      // this.listShop()
      this.agent_reset += 1
    },

    resetBtn2() {
      //重置
      this.resetData2() //重置请求数据
      this.pageNum2 = 1
      this.getcenterList()
    },

    resetData() {
      //重置请求数据
      this.recommend_tag = 1
      this.pageNum = 1
      this.task_sn = ''
      this.demand_sn = ''
      this.staff_name = ''
      this.mobile = ''
      this.type_arr = ''
      this.label_id = ''
      this.label_name = ''
      this.business_id = ''
      this.business_name = ''
      this.shop_id = ''
      this.shop_name = ''
      this.status = '10'
      this.next_task_sn = ''
      this.next_task_sn2 = ''
      this.multipleSelection = ''
      this.index = '10'
      //重置人才列表，且不可分配
      this.getcenterList()
      this.job_level = "" //用工等级


      //判断今天是否周五
      this.ruleForm.date1 = this.date(1) + ' 00:00:00'
      if (this.$moment().day() == 5) {
        this.ruleForm.date2 = this.date(3) + ' 23:59:00'
      } else {
        this.ruleForm.date2 = this.date(1) + ' 23:59:00'
      }
    },

    resetData2() {
      //重置请求数据
      this.pageNum = 1
      this.is_appointment = ''
      this.next_name = ''
      this.next_mobile = ''
      this.onStreamTimeStart = ''
      this.onStreamTimeEnd = ''
      this.next_type_arr = ''
      this.next_label_id = ''
      this.next_label_name = ''
      this.next_sex = ''
      this.next_start = ''
      this.next_next = ''
    },
    //任务统计条数
    async statistics_sum() {
      // if (this.s_time_slot.length == 0) {
      // 	this.$message.error('请选择商圈！')
      // 	return
      // }
      var s_departmentIds_Arr = new Array()
      this.s_time_slot.forEach(element => {
        let [id, name] = element.split('|') // es6 数组解构赋值
        s_departmentIds_Arr.push(id.toString())
      })

      try {
        let ret = await queryStatistics({
          task_sn: this.task_sn,
          demand_sn: this.demand_sn,
          staff_name: this.staff_name,
          mobile: this.mobile,
          shop_id: this.shop_id,
          area_id: s_departmentIds_Arr.toString(),
          label_id: this.label_id,
          city_id: this.city_id,
          agent_id: this.agent_id,
          time_type: this.time_type,
          start_time: this.ruleForm.date1,
          end_time: this.ruleForm.date2,
          flow_path: 1
        })
        this.statistic.abnormal = ret.abnormal_accept || 0 //超时未确认
        this.statistic.assigning = ret.assigning || 0 //待分配（待确认+已撤销）
        this.statistic.withdraw = ret.withdraw || 0 //已撤销
        this.statistic.assigned = ret.assigned || 0 //待确认
        this.statistic.issued = ret.issued || 0 //待下发
        this.statistic.cancel = ret.cancel || 0 //取消
        // this.statistic.all = ret.accept + ret.checkin + ret.finish + ret.withdraw + ret.cancel //所有状态的任务
        this.statistic.all =
          ret.assigning +
          ret.issued +
          ret.assigned +
          ret.accept +
          ret.checkin +
          ret.finish +
          ret.withdraw +
          ret.cancel +
          ret.settlement //所有状态的任务
      } catch (err) { }
    },

    //跳转店铺列表
    shopLists(row) {
      const { href } = this.$router.resolve({
        path: '/shopList',
        query: { shop_name: row.shop_name, shop_id: row.shop_id }
      })
      window.open(href, '_blank')
    },

    // 跳转任务详情
    goToMore(row) {
      const { href } = this.$router.resolve({
        path: '/roleMain',
        query: {
          rl_id: row.demand_id,
          rl_sn: row.demand_sn,
          task_id: row.id,
          task_sn: row.task_sn,
          start_date: row.start_date
        }
      })
      window.open(href, '_blank')
    },

    // 跳转任务列表
    goToMoreList(row) {
      const { href } = this.$router.resolve({
        path: '/tasklist',
        query: { task_sn: row.task_sn, start: this.ruleForm.date1, end: this.ruleForm.date2 }
      })
      window.open(href, '_blank')
    },

    //店铺的自动完成
    querySearch(queryString, cb) {
      var restaurants = this.shopList
      var results = queryString ? restaurants.filter(this.createFilter(queryString)) : restaurants
      // 调用 callback 返回建议列表的数据
      cb(results)
    },
    createFilter(queryString) {
      return restaurant => {
        return restaurant.value.toLowerCase().indexOf(queryString.toLowerCase()) === 0
      }
    },
    handleSelect(item) {
      this.shop_id = item.id
    },

    //分页组件->子组件传值
    onChildValue(item) {
      this.pageNum = item[0]
      this.pageSizeNow = item[1]
      if (this.areaList.length > 0) {
        this.listShop()
      }
    },

    //分页组件->子组件传值
    onChildValue2(item) {
      this.pageNum2 = item[0]
      this.pageSizeNow2 = item[1]
      if (this.areaList.length > 0) {
        //下面的列表数据
        this.getcenterList()
      }
    },

    //导出
    downloadOrder() {
      if (this.next_date == null) {
        this.next_date = ''
      }
      if (this.onStreamTimeStart == null) {
        this.onStreamTimeStart = ''
      }
      if (this.onStreamTimeEnd == null) {
        this.onStreamTimeEnd = ''
      }
      let obj = {
        token: JSON.parse(sessionStorage.getItem('manageInfo')).token,
        export: 2,
        task_sn: this.next_task_sn,
        is_appointment: this.is_appointment,
        job_areas: this.next_area_id,
        job_types: this.next_label_id,
        gender: this.next_sex,
        work_date: this.next_date,
        start_time: this.onStreamTimeStart,
        end_time: this.onStreamTimeEnd,
        age_start: this.next_start,
        age_end: this.next_next,
        mobile: this.next_mobile,
        name: this.next_name
      }
      let param = $.param(obj)
      window.location.href = this.url + '/dispatch/taskStaffList?' + param
    },
    changeBtndialogtype() {
      let [id, name] = this.type_arr.split('|') // es6 数组解构赋值
      this.label_id = id
      this.label_name = name
    },
    changeBtndialogtype_next() {
      let [id, name] = this.next_type_arr.split('|') // es6 数组解构赋值
      console.log("岗位" + id)
      this.next_label_id = id
      this.next_label_name = name
      this.next_label_id2 = id
      this.next_label_name2 = name
    },
    //标签接口
    async alljob_type() {
      try {
        let ret = await fetchLabelList({
          label_type: 'job_type'
        })
        this.TypeArr = ret
      } catch (err) { }
    },
    //全选-取消全选商圈
    selectAllArea() {
      let arr = []
      this.areaList.forEach(item => {
        arr.push(`${item.id}|${item.area_name}`)
      })
      if (this.areaStatus == true) {
        this.s_time_slot = arr
      } else {
        this.s_time_slot = []
      }
      this.areaStatus = !this.areaStatus
      // this.shearchBtn()
    },
    changeBtndialogarea() {
      this.shearchBtn()
    },
    changeBtndialogAllArea() {
      this.shearchBtn()
    },
    changeBtndialogarea_next() {
      let [id, name] = this.next_area_arr.split('|') // es6 数组解构赋值
      this.next_area_id = id
      this.next_area_name = name
    },
    // 获取商圈列表
    async listArea(city_id) {
      try {
        this.s_time_slot = []
        let ret = await fetchAreaList({
          city_id: city_id,
          agent_id: this.agent_id
        })
        console.log(ret)
        if (ret.list.length) {
          ret.list.forEach(item => {
            item.value = item.area_name
          })
          this.areaList = ret.list

          // 如果本地this.area_arr。存在值，那么不再赋予，如果不存在。赋予相关值
          // if (this.s_time_slot == '' || this.s_time_slot == null) {
          // 	// 默认选中非254-平谷的
          // 	this.areaList.forEach(element => {
          // 		// 平谷
          // 		if (element.area_name != '平谷' && element.area_name != '华成商圈' && element.id != 0) {
          // 			var pusharr = element.id + '|' + element.area_name
          // 			this.s_time_slot.push(pusharr)
          // 		}
          // 	})
          // }
          if (this.selectedAreasMap[`city-${city_id}`] && this.selectedAreasMap[`city-${city_id}`].length) {
            this.s_time_slot = this.selectedAreasMap[`city-${city_id}`]
          }
        } else {
          this.areaList = []
        }
      } catch (err) {
        console.log('--------11111 err', err)
      }
    },
    async getReasonList() {
      try {
        let ret = await fetchReasonList()
        this.all_revoke = ret
      } catch (err) { }
    },
    tagstate(e) {
      if (e == 20 && this.recommend_tag == 3 || e == 300 && this.recommend_tag == 3 || e == 20 && this.recommend_tag == 4 || e == 300 && this.recommend_tag == 4) {
        this.recommend_tag = 1
      }
      this.index = e
      this.status = e
      //请求任务列表接口
      this.pageNum = 1
      this.listShop()
      //重置人才列表，且不可分配
      this.getcenterList()
      this.next_task_sn = ''
      this.next_task_sn2 = ''
      this.multipleSelection = ''
    },
    // 任务取消-弹框确认
    async addMenuBtn() {
      if (!this.cancel.reason) {
        this.$message.error('请选择取消原因！')
        return
      }
      try {
        let ret = await taskCancel({
          sn: this.sn,
          reason_id: this.cancel.reason,
          remark: this.cancel.bz
        })
        this.$message.success('任务取消成功')
        this.hiddenRY()
        setTimeout(() => {
          this.listShop()
        }, 1000)
      } catch (err) { }
    },
    //任务撤销
    async addCxBtn() {
      try {
        let ret = await taskWithdraw({
          sn: this.sn,
          reason_id: this.revoke.reason,
          remark: this.revoke.bz
        })
        this.$message.success('任务撤销成功')
        this.hiddenRY()
        setTimeout(() => {
          this.listShop()
        }, 1000)
      } catch (err) { }
    },
    //分配
    fenpeiBtn(e, index) {
      if (this.multipleSelection == '') {
        this.$message.error('请选择相关任务')
        return
      }
      this.demandInfowhere = e.demandInfowhere
      this.fp_staff_id = e.staff_id //人员id
      this.fp_staff_name = e.name //人员名
      this.fp_staff_sn = e.staff_sn //人员sn
      this.FPShowStop = true //分配任务
      this.diaTitle = '确认分配'
    },
    // 全景调度-第二次的弹框
    next() {
      // 直接分配
      this.assign(this.multipleSelection)
    },
    // 全景调度-第二次弹框的确认
    distribution() {
      //选中的行，进行分配
      if (this.multipleSelectionSelect == '') {
        this.$message.error('请选择相关任务！')
        return
      }
      this.demandInfowhere = null
      this.assign(this.multipleSelectionSelect.toString())
      this.NextShow = false
    },
    //获取选中行的id
    handleSelectionSelect(val) {
      this.multipleSelectionSelect = []
      val.forEach(item => {
        this.multipleSelectionSelect.push(item.sn)
      })
      this.multipleSelectionSelect = Array.from(new Set(this.multipleSelectionSelect))
    },
    //进行分配
    async assign(e) {
      try {
        let obj = {
          sn: e,
          staff_sn: this.fp_staff_sn,
          staff_name: this.fp_staff_name,
          staff_id: this.fp_staff_id,
          log_data: this.log_data
        }
        if (this.AssignmentTips == true) {
          obj = {
            ...obj,
            force: 1 //任务超过11小时，还是继续分配
          }
        }

        let ret = await taskIssued(obj)
        this.$message.success('任务分配成功')
        setTimeout(() => {
          this.listShop()
          this.getcenterList()
        }, 1000)
        //打开第二个的弹框
        if (this.demandInfowhere != null) {
          this.NextShow = true
          this.diaTitle = '该需求中的以下任务和该人才匹配，是否也要分配给该人才？'
        }
        this.hiddenRY()
      } catch (err) {
        if (+err.code === 626) {
          //强制确认的弹框出现
          this.AssignmentTips = true
          this.AssignmentTips_reason = err.data
        }
      }
    },
    //修改
    editBtn(e, index) {
      this.ids = e.id
      this.sn = e.task_sn
      this.index = index
      this.TaskEdit = true //修改任务
      this.diaTitle = '修改任务'
      // 查询任务详情
      let fn = new FormData()
      fn.append('id', this.ids)
      this.$http.post(this.url + '/task/info', fn).then(
        res => {
          if (res.data.msg == '查询成功' || res.data.code == '200') {
            var ask_info = res.data.data
            this.edit_task_sn = ask_info.sn
            this.edit_time1 = ask_info.start_time
            this.edit_time2 = ask_info.end_time
            this.edit_date = ask_info.hour_expect //计划时长
            this.edit_hour_actual = ask_info.hour_actual //实际时长
            this.manual_task_remark = ask_info.task_description
            if (ask_info.actual_end_time) {
              this.actual_end_time = ask_info.actual_end_time
            }
            if (ask_info.checkin_time == '0000-00-00 00:00:00') {
              this.edit_checkin_time = '' //签到时间
            } else {
              this.edit_checkin_time = ask_info.checkin_time //签到时间
              // this.edit_checkin_time = ask_info.actual_start_time //签到时间
            }
            if (ask_info.actual_start_time) {
              this.actual_start_time = ask_info.actual_start_time //计费开始时间
              this.actual_start_time2 = ask_info.actual_start_time //计费开始时间
            }
            this.edit_hour_delay = ask_info.hour_delay //延长时长
            this.edit_price = ask_info.checkin_time //价格
            if (ask_info.actual_end_time == '0000-00-00 00:00:00') {
              this.edit_finish_time = '' //完成时间
            } else {
              this.edit_finish_time = ask_info.actual_end_time //完成时间
            }
            if (ask_info.actual_end_time == '0000-00-00 00:00:00') {
              this.edit_finish_time2 = '' //完成时间
            } else {
              this.edit_finish_time2 = ask_info.actual_end_time //完成时间
            }
            if (this.edit_finish_time == undefined) {
              this.edit_finish_time = ''
            }
            if (this.edit_finish_time2 == undefined) {
              this.edit_finish_time2 = ''
            }
            // this.fp_staff_sn = ask_info.actual_end_time;
            this.edit_static = ask_info.status.toString()
            this.edit_static2 = ask_info.status.toString()
            this.amout_shop = ask_info.amout_shop
            this.staff_remark = ask_info.staff_remark.trim()
            this.edit_is_prepay = ask_info.is_prepay
          } else if (res.data.code == '8886') {
            //code   8886  登录过期
            sessionStorage.clear()
            this.$alert('登录已过期，请重新登录 !', '提示', {
              confirmButtonText: '确定',
              callback: action => {
                window.location = 'login.html'
              }
            })
            return
          } else {
            this.$message.error(res.data.msg)
            return
          }
        },
        res => {
          this.$message.error('网络错误！')
          return
        }
      )
    },
    //签到
    signIn(e, index) {
      this.ids = e.id
      this.sn = e.task_sn
      this.index = index
      this.TaskSignIn = true
      this.diaTitle = '手动签到'
      // 查询任务详情
      this.gettaskInfo()
    },
    async gettaskInfo() {
      try {
        let ret = await taskInfo({
          id: this.ids
        })
        this.edit_task_sn = ret.sn
        this.edit_time1 = ret.start_time
        this.edit_time2 = ret.end_time
        this.edit_date = ret.hour_expect //计划时长
        this.manual_task_remark = ret.task_description
        if (ret.checkin_time == '0000-00-00 00:00:00') {
          this.edit_checkin_time = '' //签到时间
        } else {
          this.edit_checkin_time = ret.checkin_time //签到时间
        }
      } catch (err) { }
    },
    // 获取当前的人才详情
    // personnelInfo
    async recordBtn(row) {
      this.recordStatus = true
      this.personnelInfo = row
      this.nowork.staff_sn = row.staff_sn
      await this.fetchUserInfo(row)
    },
    async fetchUserInfo(row) {
      try {
        let ret = await getUserInfo({
          staff_id: row.staff_id,
          work_date: this.$moment().add('days', 1).format('YYYY-MM-DD'),
          sum_day: 7
        })
        ret.forEach((item, index) => {
          if (item.time_slot) {
            item.time_slot.forEach(element => {
              this.richengshezhi[element - 1].arr[index].is_set = true
            })
            this.richengshezhi[0].arr[index].id = item.id
          }
        })
      } catch (err) { }
    },
    // 获取未出工的原因
    async notWorkReason() {
      let ret = await noWorkReason({ label_type: 'no_work_reason' })
      this.notWorkList = ret
    },
    async addModify() {
      try {
        if (!this.nowork.reason_id) {
          this.$message.error('请选择未派工原因')
          return
        }

        await createNowork(this.nowork)
        this.$message.success('保存成功')
        this.clonseModify()
      } catch (err) {
        console.log(err)
      }
    },
    clonseModify() {
      this.recordStatus = false
      this.nowork = {}
      this.setRichengshezhi()
    },
    //取消
    redactBtn(e, index) {
      this.ids = e.id
      this.sn = e.task_sn
      this.index = index
      this.StateShowStop = true
      this.diaTitle = '取消任务'
    },
    //撤回
    withdraw(e, index) {
      this.ids = e.id
      this.sn = e.task_sn
      this.index = index
      this.StateShowcx = true
      this.diaTitle = '撤销任务'
    },
    distributionAll(row) {
      if (row) {
        // 单个下发，记录数量，记录sn
        this.diaTitle_sn = row.task_sn
        this.diaTitle = '下发任务'
        this.StateDistrimessage = '确认要将该任务下发吗？'
      } else {
        //全部下发，传递搜索参数
        this.diaTitle_sn = ''
        this.diaTitle = '一键下发任务'
        this.StateDistrimessage = '确认要将' + this.total + '条任务一起下发吗？'
      }
      this.StateDistribution = true
    },
    //隐藏所有的弹框
    hiddenRY() {
      this.StateShowStart = false
      this.StateShowStop = false
      this.FPShowStop = false
      this.StateShowcx = false
      this.StateDistribution = false
      this.TaskEdit = false
      this.TaskSignIn = false
      this.AssignmentTips = false
      this.AssignmentTips_reason = []

      this.revoke.zrf = '' //责任方清空
      this.revoke.type = '' //类型清空
      this.revoke.reason = '' //原因清空
      this.revoke.bz = '' //备注清空
      this.revoke_type = [] //撤销类型列表清空
      this.revoke_reason = [] //撤销原因列表清空

      this.cancel.zrf = '' //责任方清空
      this.cancel.type = '' //类型清空
      this.cancel.reason = '' //原因清空
      this.cancel.bz = '' //备注清空
      this.cancel_type = [] //取消类型列表清空
      this.cancel_reason = [] //取消原因列表清空

      //修改输入框清空
      this.edit_task_sn = ''
      this.edit_time1 = ''
      this.edit_time2 = ''
      this.edit_date = '' //计划时长
      this.actual_end_time = ''
      this.edit_checkin_time = '' //签到时间
      this.actual_start_time = '' //计费开始时间
      this.actual_start_time2 = '' //计费开始时间
      this.edit_hour_delay = '' //延长时长
      this.edit_price = '' //价格
      this.edit_finish_time = '' //完成时间
      this.edit_finish_time2 = '' //完成时间
      this.edit_hour_actual = ''
      // this.fp_staff_sn = '';
      this.edit_static = ''
      this.edit_static2 = ''
      this.amout_shop = ''
      this.manual_checkin_time = ''
      this.manual_remark = ''
      this.manual_task_remark = ''
      this.update_remark = ''
      this.staff_remark = ''
      this.range_time = ''
    },
    // TODO: 多等级
    recommend(index) {
      this.is_appointment = ''
      this.next_task_sn = this.next_task_sn2
      this.next_label_id = this.next_label_id2
      this.next_type_arr = this.next_label_name2
      if (index == 2 || index == 4) {
        //推荐的按钮
        // 时间同步
        this.next_date = this.start_date_save
        if (this.next_task_sn != '') {
          //时间与商圈变为空
          // 设置底部搜索栏中部分变灰
          this.next_date_disabled = true //选择时间
          this.onStreamTimeStart_disabled = true //开始
          this.onStreamTimeEnd_disabled = true //结束
          this.next_area_arr_disabled = true //商圈
          this.next_type_arr_disabled = true //选择岗位
          this.next_sex_disabled = true //选择性别
          this.next_start_disabled = true //最小年龄
          this.next_next_disabled = true //最大年龄
          //执行推荐的接口
          this.pageNum2 = 1
          this.recommend_tag = index
          this.getcenterList()
        } else {
          this.$message.error('请选择相关任务！')
        }
      } else {
        this.recommend_tag = index
        //点击了全部
        // this.$refs.multipleTable.toggleRowSelection(); //全部取消选中
        // 恢复状态
        this.next_date_disabled = false //选择时间
        this.onStreamTimeStart_disabled = false //开始
        this.onStreamTimeEnd_disabled = false //结束
        this.next_area_arr_disabled = false //商圈
        this.next_type_arr_disabled = false //选择岗位
        this.next_sex_disabled = false //选择性别
        this.next_start_disabled = false //最小年龄
        this.next_next_disabled = false //最大年龄
        //执行全部的接口
        this.pageNum2 = 1
        this.next_area_arr2 = this.next_area_arr2
        this.getcenterList()
      }
    },
    recommend2() {
      this.next_date_disabled = false //选择时间
      this.onStreamTimeStart_disabled = false //开始
      this.onStreamTimeEnd_disabled = false //结束
      this.next_area_arr_disabled = false //商圈
      this.next_type_arr_disabled = false //选择岗位
      this.next_sex_disabled = false //选择性别
      this.next_start_disabled = false //最小年龄
      this.next_next_disabled = false //最大年龄
      this.is_appointment = 1
      this.next_area_arr = ''
      this.next_type_arr = ''
      // 时间同步
      this.next_date = this.start_date_save
      this.next_task_sn = this.next_task_sn2
      this.next_label_id = ""

      if (this.next_task_sn != '') {
        this.recommend_tag = 3
        this.getcenterList()
      } else {
        this.$message.error('请选择相关任务！')
      }
    },
    //任务修改
    async taskBtnEdit() {
      // if (!this.update_remark) {
      // 	this.$message.error('请填写备注')
      // 	return
      // }
      await taskSave({
        id: this.ids,
        sn: this.sn,
        status: this.edit_static, //任务状态
        // checkin_time: this.edit_checkin_time, //签到时间
        actual_start_time: this.actual_start_time, //计费开始时间
        hour_delay: this.edit_hour_delay, //延时时长
        finish_time: this.edit_finish_time, //结束时间
        hour_actual: this.edit_hour_actual, //实际时长
        amout_shop: this.amout_shop, //价格
        finish_time_origin: this.edit_time2, //结束时间-固定传值
        task_description: this.manual_task_remark
          ? this.manual_task_remark + ';' + this.update_remark.trim()
          : this.update_remark.trim(),
        staff_remark: this.staff_remark.trim()
      })
      this.$message.success('任务修改成功')
      this.listShop()
      this.hiddenRY()
    },
    //手动签到
    async taskBtnManual() {
      if (!this.manual_checkin_time) {
        this.$message.error('签到时间不为空')
        return
      }
      if (!this.manual_remark) {
        this.$message.error('备注不能为空')
        return
      }

      try {
        let ret = await taskCheckin({
          sn: this.sn,
          checkin_time: this.manual_checkin_time, //签到时间
          task_description: this.manual_task_remark
            ? this.manual_task_remark + ';' + this.manual_remark
            : this.manual_remark // 任务备注+签到备注
        })
        this.$message.success('签到成功')
        this.listShop()
        this.hiddenRY()
      } catch (err) { }
    },
    //一键下发确认
    async toDistribution() {
      let obj
      if (this.diaTitle_sn) {
        //单个下发
        obj = {
          task_sn: this.diaTitle_sn
        }
      }

      if (!this.diaTitle_sn) {
        //批量下发
        var s_departmentIds_Arr = []
        this.s_time_slot.forEach(element => {
          let [id, name] = element.split('|')
          s_departmentIds_Arr.push(id.toString())
        })
        obj = {
          task_sn: this.task_sn,
          demand_sn: this.demand_sn,
          staff_name: this.staff_name,
          mobile: this.mobile,
          shop_id: this.shop_id,
          area_id: s_departmentIds_Arr.toString(),
          agent_id: this.agent_id,
          label_id: this.label_id,
          status: this.status,
          time_type: this.time_type,
          start_time: this.ruleForm.date1,
          end_time: this.ruleForm.date2,
          city_id: this.city_id
        }
      }
      try {
        let ret = await taskToIssued(obj)

        this.$message.success('任务下发成功')
        this.hiddenRY()
        setTimeout(() => {
          this.listShop()
          this.getcenterList()
        }, 1000)
      } catch (err) { }
    },
    abelEadit() {
      if (this.edit_static == '50' && this.edit_static2 != '50') {
        this.edit_finish_time = this.date_now()
      } else {
        this.edit_finish_time = this.edit_finish_time2
      }
      //完成时间改变
      this.edit_finish_time_change()
    },
    //实际时长的计算
    difference(a, b) {
      // console.log(a + '开始时间')
      // console.log(b + '完成时间')
      var checkin_time_times = new Date(a).getTime()
      var finish_time_times = new Date(b).getTime()
      var endtimes = finish_time_times - checkin_time_times
      console.log(endtimes + '时间差')
      if (endtimes <= 0) {
        this.edit_hour_actual = 0
      } else {
        // 总秒数
        var second = Math.floor(endtimes / 1000)
        var hour = second / 3600
        // 小时
        var hr = hour.toFixed(2)
        if (window.isNaN(hr) == true) {
          hr = 0
        }
        console.log(hr + '时间差（小时）')
        this.edit_hour_actual = hr
      }
    },
    //进入单元行
    cellMouseEnter(row, column, cell, event) {
      publicData.isShowLoading = false
      // 请求人员资料信息
      let fn = new FormData()
      fn.append('staff_id', row.staff_id)
      fn.append('shop_sn', this.next_shop_sn)
      setTimeout(() => {
        this.$http.post(this.url + '/user/history', fn).then(
          res => {
            if (res.data.msg == '操作成功！' || res.data.code == '200') {
              var user_history = res.data.data
              if (user_history.avatar != undefined) {
                // 头像判断
                if (user_history.avatar == '') {
                  user_history.avatar = this.head_url + 'images/160102759620181.png'
                } else {
                  if (user_history.avatar.indexOf('https') == -1) {
                    // 自己传的头像
                    user_history.avatar = this.head_url + user_history.avatar
                  } else {
                    // 微信头像
                    user_history.avatar = user_history.avatar
                  }
                }
                this.user_history = user_history
              } else {
                this.user_history = {
                  avatar: this.head_url + 'images/160102759620181.png',
                  education: '无',
                  level: 0,
                  service_history: [],
                  task_history: [],
                  address: '',
                  detailed_address: ''
                }
              }
            }
          },
          res => { }
        )
      }, 300)
    },
    // 离开单元行
    cellMouseLeave() {
      setTimeout(() => {
        publicData.isShowLoading = true
      }, 1000)
    },
    //进入单元行
    cellMouseEnterSD(row, column, cell, event) {
      console.log(row)
      publicData.isShowLoading = false
      // 请求人员资料信息
      let fn = new FormData()
      fn.append('work_date', this.next_date)
      fn.append('staff_sn', row.staff_sn)
      setTimeout(() => {
        this.$http.post(this.url + '/dispatch/staffScheduleList', fn).then(
          res => {
            if (res.data.msg == '操作成功！' || res.data.code == '200') {
              this.user_historySD = res.data.data.list
            }
          },
          res => { }
        )
      }, 300)
    },
    // 离开单元行
    cellMouseEnterSDLeave() {
      setTimeout(() => {
        publicData.isShowLoading = true
      }, 1000)
    },
    //跳转人才画像
    toPersonnelListHx(row) {
      const { href } = this.$router.resolve({ path: '/personnelListHx', query: { id: row.staff_id } })
      window.open(href, '_blank')
    },
    //跳转任务列表
    toTasklist(row) {
      const { href } = this.$router.resolve({ path: '/tasklist', query: { name: row.name } })
      window.open(href, '_blank')
    },
    //签到时间改变
    edit_checkin_time_change() {
      if (this.edit_checkin_time != '') {
        if (this.actual_start_time2 == '0000-00-00 00:00:00') {
          console.log('?1')
          //实际结束时间-实际开始时间
          this.actual_start_time = this.edit_checkin_time //赋值于计费开始时间
          this.difference(this.actual_start_time, this.actual_end_time)
        } else {
          console.log('?2')
          //签到时间-任务开始时间>5的时候，则赋值
          var cha = this.time_dis(this.edit_time1, this.edit_checkin_time)
          console.log(cha)
          if (cha >= 5) {
            console.log('?3')
            this.actual_start_time = this.edit_checkin_time //赋值于计费开始时间
          } else {
            this.actual_start_time = this.edit_time1 //赋值于计费开始时间
          }
          //实际结束时间-实际开始时间
          this.difference(this.actual_start_time, this.actual_end_time)
        }
      }
    },
    //完成时间改变
    edit_finish_time_change() {
      if (this.edit_finish_time != '') {
        this.actual_end_time = this.edit_finish_time
        this.difference(this.actual_start_time, this.actual_end_time)
      }
    },
    //跳转店铺-坐标
    shop_map(row, name) {
      window.open(
        'https://uri.amap.com/marker?position=' +
        row[0] +
        ',' +
        row[1] +
        '&name=' +
        name +
        '&src=mypage&coordinate=gaode&callnative=0',
        '_blank'
      )
    },
    handleSelectionChangeNext() {
      this.richengshezhi.forEach((element, index) => {
        for (let num = 0;num < 7;num++) {
          this.richengshezhi[index].arr[num].is_set = this.statusTag
        }

        this.checked.forEach((next, count) => {
          this.checked[count].is_set = this.statusTag
        })
      })
      this.statusTag = !this.statusTag
    },
    checkboxChange(index) {
      for (let num = 0;num < 7;num++) {
        this.richengshezhi[index].arr[num].is_set = this.checked[index].is_set == true ? true : false
      }
    },
    setRichengshezhi() {
      this.recordStatus = false
      this.richengshezhi = [
        {
          arr: [
            {
              id: '',
              is_set: false,
              value: '早'
            },
            {
              id: '',
              is_set: false,
              value: '早',
              inedx: 1
            },
            {
              id: '',
              is_set: false,
              value: '早'
            },
            {
              id: '',
              is_set: false,
              value: '早'
            },
            {
              id: '',
              is_set: false,
              value: '早'
            },
            {
              id: '',
              is_set: false,
              value: '早'
            },
            {
              id: '',
              is_set: false,
              value: '早'
            }
          ]
        },
        {
          arr: [
            {
              is_set: false,
              value: '中'
            },
            {
              is_set: false,
              value: '中'
            },
            {
              is_set: false,
              value: '中'
            },
            {
              is_set: false,
              value: '中'
            },
            {
              is_set: false,
              value: '中'
            },
            {
              is_set: false,
              value: '中'
            },
            {
              is_set: false,
              value: '中'
            }
          ]
        },
        {
          arr: [
            {
              is_set: false,
              value: '晚'
            },
            {
              is_set: false,
              value: '晚'
            },
            {
              is_set: false,
              value: '晚'
            },
            {
              is_set: false,
              value: '晚'
            },
            {
              is_set: false,
              value: '晚'
            },
            {
              is_set: false,
              value: '晚'
            },
            {
              is_set: false,
              value: '晚'
            }
          ]
        },
        {
          arr: [
            {
              is_set: false,
              value: '夜'
            },
            {
              is_set: false,
              value: '夜'
            },
            {
              is_set: false,
              value: '夜'
            },
            {
              is_set: false,
              value: '夜'
            },
            {
              is_set: false,
              value: '夜'
            },
            {
              is_set: false,
              value: '夜'
            },
            {
              is_set: false,
              value: '夜'
            }
          ]
        }
      ]
    },
    getWeek(index) {
      let week = this.$moment().add('days', index).day()
      switch (week) {
        case 1:
          return '周一'
        case 2:
          return '周二'
        case 3:
          return '周三'
        case 4:
          return '周四'
        case 5:
          return '周五'
        case 6:
          return '周六'
        case 0:
          return '周日'
      }
    },
    async setValue(arrVal) {
      this.agent_id = arrVal.agent_id
      this.cityList = arrVal.city_list
      this.city_id = this.cityList[0].id
      this.city_val = this.cityList[0].name
      await this.listUser()
      await this.listArea(this.city_id) //商圈列表
    }
  },
  filters: {
    ReversalTime: function (value) {
      value = value % 24
      return common.getReversalTime(value)
    },
    dateshear: function (value) {
      value = value.substr(10, 6).trim()
      return value
    },
    surviveSet(status) {
      const statusMap = {
        1: '日程确认',
        2: '接活设置'
      }
      return statusMap[status]
    },
    jobLevel(status) {
      let a = that.levelList.find(x => x.id == status)
      if (a) {
        return a.name
      }
    }
  }
}
</script>

<style scoped>
@import '../../assets/style/taskassignments.css';
</style>
<style>
.taskAssignments .tableMaxBox .el-table th .el-checkbox__input {
  display: none;
}

.richengshezhi .el-table th .el-checkbox__input {
  display: block;
}

.set-border-radius .el-checkbox__inner {
  border-radius: 100%;
}

.show-warn {
  background: rgb(201, 58, 50);
  color: rgb(255, 255, 255);
  padding: 1px 1px;
  border-radius: 3px;
  text-align: center;
  line-height: initial;
  float: left;
}
.next_button {
  flex: 1;
}

.next_button span {
  font-size: 12px;
  padding: 0 7px;
}
</style>



// WEBPACK FOOTER //
// src/components/abnormal/TaskAssignments.vue